bianic-ui 2.10.0-beta.2 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -49
- package/dist/cjs/Empty.svg +12 -0
- package/dist/cjs/index.js +556 -3347
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/Checkbox/index.d.ts +2 -1
- package/dist/cjs/types/components/Forms/Dropdown/DropdownContainer.d.ts +1 -1
- package/dist/cjs/types/components/Sidebar/SidebarCointainer.d.ts +7 -6
- package/dist/cjs/types/components/Sidebar/SidebarItem.d.ts +9 -5
- package/dist/cjs/types/components/Sidebar/SidebarMenu.d.ts +10 -0
- package/dist/cjs/types/components/Sidebar/SidebarProfile.d.ts +17 -0
- package/dist/cjs/types/components/Sidebar/config.d.ts +21 -0
- package/dist/cjs/types/components/Sidebar/index.d.ts +2 -0
- package/dist/cjs/types/components/Table/Table.d.ts +6 -0
- package/dist/cjs/types/components/Table/TableBody.d.ts +6 -0
- package/dist/cjs/types/components/Table/TableHead.d.ts +6 -0
- package/dist/cjs/types/components/Table/TableRow/index.d.ts +6 -0
- package/dist/cjs/types/components/Table/TableUtility/BlockLoading.d.ts +6 -0
- package/dist/cjs/types/components/Table/TableUtility/EmptyTable.d.ts +7 -0
- package/dist/cjs/types/components/Table/TableUtility/TableFooterController.d.ts +12 -0
- package/dist/cjs/types/components/Table/TableUtility/TableHeaderController.d.ts +9 -0
- package/dist/cjs/types/components/Table/TableUtility/TableSearchInput.d.ts +11 -0
- package/dist/cjs/types/components/Table/TableUtility/index.d.ts +5 -0
- package/dist/cjs/types/components/Table/index.d.ts +5 -0
- package/dist/cjs/types/components/TagLabel/index.d.ts +1 -1
- package/dist/cjs/types/components/index.d.ts +3 -2
- package/dist/cjs/types/image/index.d.ts +2 -0
- package/dist/cjs/types/stories/Form/Checkbox/Checkbox.stories.d.ts +0 -1
- package/dist/cjs/types/stories/Form/Checkbox/CheckboxSimulation.stories.d.ts +0 -1
- package/dist/cjs/types/stories/Form/Dropdown/DropdownContainer.stories.d.ts +1 -1
- package/dist/cjs/types/stories/Sidebar/SidebarContainer.stories.d.ts +1 -2
- package/dist/cjs/types/stories/Sidebar/SidebarItem.stories.d.ts +1 -2
- package/dist/cjs/types/utility/helper.d.ts +2 -1
- package/dist/cjs/types/utility/hooks/useTableDataHandler.d.ts +54 -0
- package/dist/esm/Empty.svg +12 -0
- package/dist/esm/index.js +545 -3348
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/Checkbox/index.d.ts +2 -1
- package/dist/esm/types/components/Forms/Dropdown/DropdownContainer.d.ts +1 -1
- package/dist/esm/types/components/Sidebar/SidebarCointainer.d.ts +7 -6
- package/dist/esm/types/components/Sidebar/SidebarItem.d.ts +9 -5
- package/dist/esm/types/components/Sidebar/SidebarMenu.d.ts +10 -0
- package/dist/esm/types/components/Sidebar/SidebarProfile.d.ts +17 -0
- package/dist/esm/types/components/Sidebar/config.d.ts +21 -0
- package/dist/esm/types/components/Sidebar/index.d.ts +2 -0
- package/dist/esm/types/components/Table/Table.d.ts +6 -0
- package/dist/esm/types/components/Table/TableBody.d.ts +6 -0
- package/dist/esm/types/components/Table/TableHead.d.ts +6 -0
- package/dist/esm/types/components/Table/TableRow/index.d.ts +6 -0
- package/dist/esm/types/components/Table/TableUtility/BlockLoading.d.ts +6 -0
- package/dist/esm/types/components/Table/TableUtility/EmptyTable.d.ts +7 -0
- package/dist/esm/types/components/Table/TableUtility/TableFooterController.d.ts +12 -0
- package/dist/esm/types/components/Table/TableUtility/TableHeaderController.d.ts +9 -0
- package/dist/esm/types/components/Table/TableUtility/TableSearchInput.d.ts +11 -0
- package/dist/esm/types/components/Table/TableUtility/index.d.ts +5 -0
- package/dist/esm/types/components/Table/index.d.ts +5 -0
- package/dist/esm/types/components/TagLabel/index.d.ts +1 -1
- package/dist/esm/types/components/index.d.ts +3 -2
- package/dist/esm/types/image/index.d.ts +2 -0
- package/dist/esm/types/stories/Form/Checkbox/Checkbox.stories.d.ts +0 -1
- package/dist/esm/types/stories/Form/Checkbox/CheckboxSimulation.stories.d.ts +0 -1
- package/dist/esm/types/stories/Form/Dropdown/DropdownContainer.stories.d.ts +1 -1
- package/dist/esm/types/stories/Sidebar/SidebarContainer.stories.d.ts +1 -2
- package/dist/esm/types/stories/Sidebar/SidebarItem.stories.d.ts +1 -2
- package/dist/esm/types/utility/helper.d.ts +2 -1
- package/dist/esm/types/utility/hooks/useTableDataHandler.d.ts +54 -0
- package/dist/index.d.ts +155 -15
- package/package.json +143 -143
- package/src/font/SansCode/README.txt +88 -88
- package/src/style/color.css +650 -650
- package/src/style/scrollbar.css +78 -78
- package/tailwind.config.js +574 -574
- package/src/font/SansCode/GoogleSansCode-Italic-VariableFont_MONO,wght.ttf:Zone.Identifier +0 -0
- package/src/font/SansCode/GoogleSansCode-VariableFont_MONO,wght.ttf:Zone.Identifier +0 -0
- package/src/font/SansCode/OFL.txt:Zone.Identifier +0 -0
- package/src/font/SansCode/README.txt:Zone.Identifier +0 -0
|
@@ -6,8 +6,9 @@ interface CheckboxProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'>
|
|
|
6
6
|
label?: string;
|
|
7
7
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
value?: string | number | readonly string[] | undefined;
|
|
9
|
+
isIndeterminate?: boolean;
|
|
9
10
|
}
|
|
10
|
-
declare function Checkbox({ disabled, id, size, label, onChange, ...props }: CheckboxProps): React.JSX.Element;
|
|
11
|
+
declare function Checkbox({ disabled, id, size, label, onChange, isIndeterminate, ...props }: CheckboxProps): React.JSX.Element;
|
|
11
12
|
declare namespace Checkbox {
|
|
12
13
|
var defaultProps: {
|
|
13
14
|
disabled: boolean;
|
|
@@ -13,7 +13,7 @@ export interface DropdownContainerProps extends ComponentPropsWithRef<'div'> {
|
|
|
13
13
|
onClickItem?: (event: React.MouseEvent<HTMLDivElement>, val: string | number | object) => void;
|
|
14
14
|
}
|
|
15
15
|
declare const DropdownContainer: {
|
|
16
|
-
(propsComp: DropdownContainerProps): React.JSX.Element
|
|
16
|
+
(propsComp: DropdownContainerProps): React.JSX.Element;
|
|
17
17
|
defaultProps: {
|
|
18
18
|
isTopFlat: boolean;
|
|
19
19
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
export interface SidebarContainerProps {
|
|
3
|
-
|
|
4
|
-
children?: ReactNode
|
|
1
|
+
import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export interface SidebarContainerProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
color?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
5
|
isMinimized?: boolean;
|
|
6
|
-
|
|
6
|
+
activeId?: string | null;
|
|
7
|
+
setActiveId?: (id?: string | null) => void;
|
|
7
8
|
}
|
|
8
|
-
declare const SidebarContainer:
|
|
9
|
+
declare const SidebarContainer: React.ForwardRefExoticComponent<SidebarContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
10
|
export default SidebarContainer;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
type SidebarItemLevel = 0 | 1 | 2;
|
|
2
3
|
export interface SidebarItemProps extends ComponentPropsWithoutRef<'button'> {
|
|
3
4
|
title: string;
|
|
4
5
|
icon?: React.ReactNode;
|
|
5
6
|
active?: boolean;
|
|
6
|
-
onClick?: () => void
|
|
7
|
+
onClick?: () => void;
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
isMinimized?: boolean;
|
|
9
|
-
isExpand?: boolean
|
|
10
|
-
notificationCount?: number
|
|
11
|
-
level?:
|
|
10
|
+
isExpand?: boolean;
|
|
11
|
+
notificationCount?: number;
|
|
12
|
+
level?: SidebarItemLevel;
|
|
13
|
+
activeId: string | null;
|
|
14
|
+
setActiveId?: (id?: string | null) => void;
|
|
15
|
+
color?: string;
|
|
12
16
|
}
|
|
13
|
-
declare const SidebarItem:
|
|
17
|
+
declare const SidebarItem: React.ForwardRefExoticComponent<SidebarItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
18
|
export default SidebarItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export interface SidebarMenu {
|
|
3
|
+
color?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
isMinimized?: boolean;
|
|
6
|
+
activeId?: string | null;
|
|
7
|
+
setActiveId?: (id?: string | null) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const SidebarMenu: ({ color, children, isMinimized, activeId, setActiveId, }: SidebarMenu) => React.JSX.Element;
|
|
10
|
+
export default SidebarMenu;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface SidebarProfileProps extends ComponentPropsWithoutRef<'button'> {
|
|
3
|
+
username: string;
|
|
4
|
+
role: string;
|
|
5
|
+
avatarImg?: React.ReactNode;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
isMinimized?: boolean;
|
|
10
|
+
isExpand?: boolean;
|
|
11
|
+
notificationCount?: number;
|
|
12
|
+
activeId?: string | null;
|
|
13
|
+
setActiveId?: (id?: string | null) => void;
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const SidebarProfile: React.ForwardRefExoticComponent<SidebarProfileProps & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
export default SidebarProfile;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const containerSizeConfig: {
|
|
2
|
+
minimized: string;
|
|
3
|
+
maximized: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const itemConfig: {
|
|
6
|
+
minimized: string;
|
|
7
|
+
maximized: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const profileConfig: {
|
|
10
|
+
minimized: string;
|
|
11
|
+
maximized: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const overlaySizeConfig: {
|
|
14
|
+
minimized: string;
|
|
15
|
+
maximized: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const buttonConfig: {
|
|
18
|
+
0: string;
|
|
19
|
+
1: string;
|
|
20
|
+
2: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { ComponentPropsWithRef } from 'react';
|
|
2
|
+
interface TableRowProps extends ComponentPropsWithRef<'tr'> {
|
|
3
|
+
variant: 'head' | 'body';
|
|
4
|
+
}
|
|
5
|
+
declare const TableRow: ({ variant, children, ...rest }: TableRowProps) => React.JSX.Element;
|
|
6
|
+
export default TableRow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
interface BlockLoadingProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
backgroundColor?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const BlockLoading: ({ className, backgroundColor, }: BlockLoadingProps) => React.JSX.Element;
|
|
6
|
+
export default BlockLoading;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface TableFooterControllerProps extends ComponentPropsWithoutRef<'div'> {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
pageSize: number;
|
|
7
|
+
setCurrentPage: Dispatch<SetStateAction<number>>;
|
|
8
|
+
setPageSize: Dispatch<SetStateAction<number>>;
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const TableFooterController: ({ currentPage, totalPages, pageSize, setCurrentPage, setPageSize, isLoading, }: TableFooterControllerProps) => React.JSX.Element;
|
|
12
|
+
export default TableFooterController;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
interface TableHeaderControllerProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
buttonActions?: ReactNode[];
|
|
4
|
+
totalData?: number;
|
|
5
|
+
firstIndex?: number;
|
|
6
|
+
lastIndex?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const TableHeaderController: ({ buttonActions, totalData, firstIndex, lastIndex, }: TableHeaderControllerProps) => React.JSX.Element;
|
|
9
|
+
export default TableHeaderController;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface TableSearchInputProps extends ComponentPropsWithoutRef<'input'> {
|
|
4
|
+
isShow: boolean;
|
|
5
|
+
onEnter?: any;
|
|
6
|
+
onClose?: any;
|
|
7
|
+
showEnter?: boolean;
|
|
8
|
+
showClose?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const TableSearchInput: ({ isShow, value, onChange, placeholder, }: TableSearchInputProps) => React.JSX.Element | null;
|
|
11
|
+
export default TableSearchInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as BlockLoading } from './BlockLoading';
|
|
2
|
+
export { default as EmptyTable } from './EmptyTable';
|
|
3
|
+
export { default as TableFooterController } from './TableFooterController';
|
|
4
|
+
export { default as TableHeaderController } from './TableHeaderController';
|
|
5
|
+
export { default as TableSearchInput } from './TableSearchInput';
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
export { default as Table } from './Table';
|
|
2
|
+
export { default as TableBody } from './TableBody';
|
|
1
3
|
export { default as TableCell } from './TableCell';
|
|
4
|
+
export { default as TableHead } from './TableHead';
|
|
5
|
+
export { default as TableRow } from './TableRow';
|
|
6
|
+
export { BlockLoading, EmptyTable, TableFooterController, TableHeaderController, TableSearchInput, } from './TableUtility';
|
|
@@ -2,7 +2,7 @@ import React, { ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
interface TagLabelProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
3
|
color: 'default' | 'blue' | 'teal' | 'green' | 'orange' | 'red' | 'black' | 'white' | 'custom';
|
|
4
4
|
size?: 'md' | 'sm' | 'tn';
|
|
5
|
-
variant?: 'label' | 'icon' | 'closeable';
|
|
5
|
+
variant?: 'label' | 'icon' | 'closeable' | 'monospace';
|
|
6
6
|
closeHandler?: () => void;
|
|
7
7
|
open?: boolean;
|
|
8
8
|
text: string;
|
|
@@ -24,12 +24,12 @@ export { default as Pills } from './Pills/Pills';
|
|
|
24
24
|
export { default as Popover } from './Popover';
|
|
25
25
|
export { ProgressBar, ProgressCircle } from './Progress';
|
|
26
26
|
export { default as ResizeableDiv } from './ResizeableDiv';
|
|
27
|
-
export { SidebarContainer, SidebarItem } from './Sidebar';
|
|
27
|
+
export { SidebarContainer, SidebarItem, SidebarMenu, SidebarProfile, } from './Sidebar';
|
|
28
28
|
export { default as Slider } from './Slider';
|
|
29
29
|
export { default as Spinner } from './Spinner/Spinner';
|
|
30
30
|
export { default as Tab } from './Tab/Tab';
|
|
31
31
|
export { default as TabMenu } from './TabMenu/TabMenu';
|
|
32
|
-
export { TableCell } from './Table';
|
|
32
|
+
export { Table, TableBody, TableCell, TableHead, TableRow, TableFooterController, TableHeaderController, TableSearchInput, EmptyTable, BlockLoading, } from './Table';
|
|
33
33
|
export { default as TagLabel } from './TagLabel';
|
|
34
34
|
export { default as Tooltip } from './Tooltip';
|
|
35
35
|
export { Display, P, Heading, Text, Link } from './Typography';
|
|
@@ -37,3 +37,4 @@ export { Toaster } from './Toaster';
|
|
|
37
37
|
export { default as VerticalStepper } from './Stepper/Vertical';
|
|
38
38
|
export { default as Window } from './Window';
|
|
39
39
|
export { getRelativeTime } from '../utility';
|
|
40
|
+
export { useTableDataHandler } from '../utility/hooks/useTableDataHandler';
|
|
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
4
|
component: {
|
|
5
|
-
(propsComp: import("../../../components/Forms/Dropdown/DropdownContainer").DropdownContainerProps): import("react").JSX.Element
|
|
5
|
+
(propsComp: import("../../../components/Forms/Dropdown/DropdownContainer").DropdownContainerProps): import("react").JSX.Element;
|
|
6
6
|
defaultProps: {
|
|
7
7
|
isTopFlat: boolean;
|
|
8
8
|
};
|
|
@@ -2,11 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import type { StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("../../components/Sidebar/SidebarCointainer").SidebarContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
|
9
|
-
tags: string[];
|
|
10
9
|
};
|
|
11
10
|
export default meta;
|
|
12
11
|
type Story = StoryObj<typeof meta>;
|
|
@@ -2,11 +2,10 @@ import type { StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component:
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("../../components/Sidebar/SidebarItem").SidebarItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
|
9
|
-
tags: string[];
|
|
10
9
|
};
|
|
11
10
|
export default meta;
|
|
12
11
|
type Story = StoryObj<typeof meta>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const childrenElement: (element: any) => any;
|
|
2
|
+
declare const cn: (...classes: Array<string | false | undefined>) => string;
|
|
2
3
|
declare const validUnion: (value: any, union: any) => any;
|
|
3
4
|
declare const useDetectOutsideClick: (ref: React.RefObject<HTMLElement>, initialState: boolean, ignoreRef?: React.RefObject<HTMLElement>, event?: string) => (boolean | import("react").Dispatch<import("react").SetStateAction<boolean>>)[];
|
|
4
|
-
export { childrenElement, validUnion, useDetectOutsideClick };
|
|
5
|
+
export { childrenElement, cn, validUnion, useDetectOutsideClick };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type SortOrder = 'asc' | 'desc';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the useTableDataHandler hook.
|
|
4
|
+
* * @interface UseTableDataOptions
|
|
5
|
+
* @property {string[]} [searchKeys] - Specific object keys to check during client-side filtering. If omitted, defaults to all keys containing string values.
|
|
6
|
+
* @property {string} [initialSortKey] - The object key to sort the table by on initial render.
|
|
7
|
+
* @property {SortOrder} [initialSortOrder='asc'] - The initial sorting direction ('asc' or 'desc').
|
|
8
|
+
* @property {boolean} [isFilterable=true] - Enables or disables client-side searching functionality.
|
|
9
|
+
* @property {boolean} [isSortable=true] - Enables or disables client-side sorting functionality.
|
|
10
|
+
* @property {boolean} [isServerSide=false] - If true, bypasses client-side processing, assuming filtering and sorting are handled by an API.
|
|
11
|
+
*/
|
|
12
|
+
interface UseTableDataOptions {
|
|
13
|
+
searchKeys?: string[];
|
|
14
|
+
initialSortKey?: string;
|
|
15
|
+
initialSortOrder?: SortOrder;
|
|
16
|
+
isFilterable?: boolean;
|
|
17
|
+
isSortable?: boolean;
|
|
18
|
+
isServerSide?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A custom hook to handle data processing for tables, managing internal states
|
|
22
|
+
* for client-side filtering (searching) and sorting. It can also safely yield control
|
|
23
|
+
* to server-side operations if configured.
|
|
24
|
+
*
|
|
25
|
+
* ### Key Features:
|
|
26
|
+
* - **Automatic Key Detection:** Automatically finds string fields to search if no `searchKeys` are provided.
|
|
27
|
+
* - **Smart Sorting:** Uses `localeCompare` for strings, standard operators for numbers, and gracefully handles `null`/`undefined` values by moving them to the bottom.
|
|
28
|
+
* - **Server-Side Ready:** Setting `isServerSide: true` disables internal processing while preserving handlers for external API synchronization.
|
|
29
|
+
*
|
|
30
|
+
* @param {any[]} initialData - The raw array of data/rows to be displayed in the table.
|
|
31
|
+
* @param {UseTableDataOptions} [options={}] - Optional configuration flags and initial states.
|
|
32
|
+
* * @returns {Object} Table state and control handlers.
|
|
33
|
+
* @returns {any[]} data - The processed array (filtered and sorted) ready for rendering.
|
|
34
|
+
* @returns {string} searchTerm - The current text being filtered against.
|
|
35
|
+
* @returns {string|undefined} sortKey - The current object key being used to sort.
|
|
36
|
+
* @returns {SortOrder} sortOrder - The current direction of the sort ('asc' or 'desc').
|
|
37
|
+
* @returns {(value: string) => void} handleSearchChange - Callback to update the search filter string.
|
|
38
|
+
* @returns {(key: string) => void} handleSortChange - Callback to trigger sorting on a specific column. Toggles direction if called on the same column consecutively.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const { data, handleSearchChange, handleSortChange } = useTableDataHandler(users, {
|
|
42
|
+
* searchKeys: ['name', 'email'],
|
|
43
|
+
* initialSortKey: 'name'
|
|
44
|
+
* });
|
|
45
|
+
*/
|
|
46
|
+
export declare const useTableDataHandler: (initialData: any[], options?: UseTableDataOptions) => {
|
|
47
|
+
data: any[];
|
|
48
|
+
searchTerm: string;
|
|
49
|
+
sortKey: string | undefined;
|
|
50
|
+
sortOrder: SortOrder;
|
|
51
|
+
handleSearchChange: (value: string) => void;
|
|
52
|
+
handleSortChange: (key: string) => void;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1, { ComponentPropsWithoutRef, ComponentPropsWithRef, ChangeEvent, ReactNode, MouseEvent, HTMLAttributes, KeyboardEvent } from 'react';
|
|
1
|
+
import React$1, { ComponentPropsWithoutRef, ComponentPropsWithRef, ChangeEvent, ReactNode, MouseEvent, HTMLAttributes, KeyboardEvent, Dispatch, SetStateAction } from 'react';
|
|
2
2
|
|
|
3
3
|
interface AccordionsProps extends ComponentPropsWithoutRef<'div'> {
|
|
4
4
|
title: string;
|
|
@@ -328,8 +328,9 @@ interface CheckboxProps$1 extends Omit<ComponentPropsWithoutRef<'input'>, 'size'
|
|
|
328
328
|
label?: string;
|
|
329
329
|
onChange?: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
|
|
330
330
|
value?: string | number | readonly string[] | undefined;
|
|
331
|
+
isIndeterminate?: boolean;
|
|
331
332
|
}
|
|
332
|
-
declare function Checkbox({ disabled, id, size, label, onChange, ...props }: CheckboxProps$1): React$1.JSX.Element;
|
|
333
|
+
declare function Checkbox({ disabled, id, size, label, onChange, isIndeterminate, ...props }: CheckboxProps$1): React$1.JSX.Element;
|
|
333
334
|
declare namespace Checkbox {
|
|
334
335
|
var defaultProps: {
|
|
335
336
|
disabled: boolean;
|
|
@@ -355,7 +356,7 @@ interface DropdownContainerProps extends ComponentPropsWithRef<'div'> {
|
|
|
355
356
|
onClickItem?: (event: React$1.MouseEvent<HTMLDivElement>, val: string | number | object) => void;
|
|
356
357
|
}
|
|
357
358
|
declare const DropdownContainer: {
|
|
358
|
-
(propsComp: DropdownContainerProps): React$1.JSX.Element
|
|
359
|
+
(propsComp: DropdownContainerProps): React$1.JSX.Element;
|
|
359
360
|
defaultProps: {
|
|
360
361
|
isTopFlat: boolean;
|
|
361
362
|
};
|
|
@@ -723,26 +724,56 @@ declare namespace ResizeableDiv {
|
|
|
723
724
|
};
|
|
724
725
|
}
|
|
725
726
|
|
|
726
|
-
interface SidebarContainerProps {
|
|
727
|
-
|
|
728
|
-
children?: ReactNode
|
|
727
|
+
interface SidebarContainerProps extends ComponentPropsWithoutRef<'div'> {
|
|
728
|
+
color?: string;
|
|
729
|
+
children?: ReactNode;
|
|
730
|
+
isMinimized?: boolean;
|
|
731
|
+
activeId?: string | null;
|
|
732
|
+
setActiveId?: (id?: string | null) => void;
|
|
733
|
+
}
|
|
734
|
+
declare const SidebarContainer: React$1.ForwardRefExoticComponent<SidebarContainerProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
735
|
+
|
|
736
|
+
interface SidebarMenu {
|
|
737
|
+
color?: string;
|
|
738
|
+
children?: ReactNode;
|
|
729
739
|
isMinimized?: boolean;
|
|
730
|
-
|
|
740
|
+
activeId?: string | null;
|
|
741
|
+
setActiveId?: (id?: string | null) => void;
|
|
731
742
|
}
|
|
732
|
-
declare const
|
|
743
|
+
declare const SidebarMenu: ({ color, children, isMinimized, activeId, setActiveId, }: SidebarMenu) => React$1.JSX.Element;
|
|
733
744
|
|
|
745
|
+
type SidebarItemLevel = 0 | 1 | 2;
|
|
734
746
|
interface SidebarItemProps extends ComponentPropsWithoutRef<'button'> {
|
|
735
747
|
title: string;
|
|
736
748
|
icon?: React$1.ReactNode;
|
|
737
749
|
active?: boolean;
|
|
738
|
-
onClick?: () => void
|
|
750
|
+
onClick?: () => void;
|
|
739
751
|
children?: React$1.ReactNode;
|
|
740
752
|
isMinimized?: boolean;
|
|
741
|
-
isExpand?: boolean
|
|
742
|
-
notificationCount?: number
|
|
743
|
-
level?:
|
|
753
|
+
isExpand?: boolean;
|
|
754
|
+
notificationCount?: number;
|
|
755
|
+
level?: SidebarItemLevel;
|
|
756
|
+
activeId: string | null;
|
|
757
|
+
setActiveId?: (id?: string | null) => void;
|
|
758
|
+
color?: string;
|
|
744
759
|
}
|
|
745
|
-
declare const SidebarItem:
|
|
760
|
+
declare const SidebarItem: React$1.ForwardRefExoticComponent<SidebarItemProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
761
|
+
|
|
762
|
+
interface SidebarProfileProps extends ComponentPropsWithoutRef<'button'> {
|
|
763
|
+
username: string;
|
|
764
|
+
role: string;
|
|
765
|
+
avatarImg?: React$1.ReactNode;
|
|
766
|
+
active?: boolean;
|
|
767
|
+
onClick?: () => void;
|
|
768
|
+
children?: React$1.ReactNode;
|
|
769
|
+
isMinimized?: boolean;
|
|
770
|
+
isExpand?: boolean;
|
|
771
|
+
notificationCount?: number;
|
|
772
|
+
activeId?: string | null;
|
|
773
|
+
setActiveId?: (id?: string | null) => void;
|
|
774
|
+
color?: string;
|
|
775
|
+
}
|
|
776
|
+
declare const SidebarProfile: React$1.ForwardRefExoticComponent<SidebarProfileProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
746
777
|
|
|
747
778
|
interface SliderProps {
|
|
748
779
|
disabled: boolean;
|
|
@@ -785,6 +816,14 @@ interface MoreDropdownTabProps extends BaseTabMenuProps {
|
|
|
785
816
|
type TabMenuProps = StandardTabProps | MoreDropdownTabProps;
|
|
786
817
|
declare const TabMenu: React$1.ForwardRefExoticComponent<TabMenuProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
787
818
|
|
|
819
|
+
interface tableProps extends ComponentPropsWithRef<'table'> {
|
|
820
|
+
}
|
|
821
|
+
declare const Table: ({ children, ...rest }: tableProps) => React$1.JSX.Element;
|
|
822
|
+
|
|
823
|
+
interface tableBodyProps extends ComponentPropsWithRef<'tbody'> {
|
|
824
|
+
}
|
|
825
|
+
declare const TableBody: ({ children, ...rest }: tableBodyProps) => React$1.JSX.Element;
|
|
826
|
+
|
|
788
827
|
interface TableCellProps extends ComponentPropsWithoutRef<'td'> {
|
|
789
828
|
variant?: 'head' | 'body';
|
|
790
829
|
lined?: boolean;
|
|
@@ -800,10 +839,57 @@ declare namespace TableCell {
|
|
|
800
839
|
};
|
|
801
840
|
}
|
|
802
841
|
|
|
842
|
+
interface tableHeadProps extends ComponentPropsWithRef<'thead'> {
|
|
843
|
+
}
|
|
844
|
+
declare const TableHead: ({ children, ...rest }: tableHeadProps) => React$1.JSX.Element;
|
|
845
|
+
|
|
846
|
+
interface TableRowProps extends ComponentPropsWithRef<'tr'> {
|
|
847
|
+
variant: 'head' | 'body';
|
|
848
|
+
}
|
|
849
|
+
declare const TableRow: ({ variant, children, ...rest }: TableRowProps) => React$1.JSX.Element;
|
|
850
|
+
|
|
851
|
+
interface BlockLoadingProps extends ComponentPropsWithoutRef<'div'> {
|
|
852
|
+
backgroundColor?: string;
|
|
853
|
+
}
|
|
854
|
+
declare const BlockLoading: ({ className, backgroundColor, }: BlockLoadingProps) => React$1.JSX.Element;
|
|
855
|
+
|
|
856
|
+
interface EmptyTableProps {
|
|
857
|
+
content?: string;
|
|
858
|
+
subContent: string;
|
|
859
|
+
}
|
|
860
|
+
declare const EmptyTable: ({ content, subContent }: EmptyTableProps) => React$1.JSX.Element;
|
|
861
|
+
|
|
862
|
+
interface TableFooterControllerProps extends ComponentPropsWithoutRef<'div'> {
|
|
863
|
+
currentPage: number;
|
|
864
|
+
totalPages: number;
|
|
865
|
+
pageSize: number;
|
|
866
|
+
setCurrentPage: Dispatch<SetStateAction<number>>;
|
|
867
|
+
setPageSize: Dispatch<SetStateAction<number>>;
|
|
868
|
+
isLoading?: boolean;
|
|
869
|
+
}
|
|
870
|
+
declare const TableFooterController: ({ currentPage, totalPages, pageSize, setCurrentPage, setPageSize, isLoading, }: TableFooterControllerProps) => React$1.JSX.Element;
|
|
871
|
+
|
|
872
|
+
interface TableHeaderControllerProps extends ComponentPropsWithoutRef<'div'> {
|
|
873
|
+
buttonActions?: ReactNode[];
|
|
874
|
+
totalData?: number;
|
|
875
|
+
firstIndex?: number;
|
|
876
|
+
lastIndex?: number;
|
|
877
|
+
}
|
|
878
|
+
declare const TableHeaderController: ({ buttonActions, totalData, firstIndex, lastIndex, }: TableHeaderControllerProps) => React$1.JSX.Element;
|
|
879
|
+
|
|
880
|
+
interface TableSearchInputProps extends ComponentPropsWithoutRef<'input'> {
|
|
881
|
+
isShow: boolean;
|
|
882
|
+
onEnter?: any;
|
|
883
|
+
onClose?: any;
|
|
884
|
+
showEnter?: boolean;
|
|
885
|
+
showClose?: boolean;
|
|
886
|
+
}
|
|
887
|
+
declare const TableSearchInput: ({ isShow, value, onChange, placeholder, }: TableSearchInputProps) => React$1.JSX.Element | null;
|
|
888
|
+
|
|
803
889
|
interface TagLabelProps extends ComponentPropsWithoutRef<'div'> {
|
|
804
890
|
color: 'default' | 'blue' | 'teal' | 'green' | 'orange' | 'red' | 'black' | 'white' | 'custom';
|
|
805
891
|
size?: 'md' | 'sm' | 'tn';
|
|
806
|
-
variant?: 'label' | 'icon' | 'closeable';
|
|
892
|
+
variant?: 'label' | 'icon' | 'closeable' | 'monospace';
|
|
807
893
|
closeHandler?: () => void;
|
|
808
894
|
open?: boolean;
|
|
809
895
|
text: string;
|
|
@@ -957,4 +1043,58 @@ declare function Window({ size, title, zIndex, onClose, ...rest }: WindowProps):
|
|
|
957
1043
|
*/
|
|
958
1044
|
declare function getRelativeTime(date: Date): string;
|
|
959
1045
|
|
|
960
|
-
|
|
1046
|
+
type SortOrder = 'asc' | 'desc';
|
|
1047
|
+
/**
|
|
1048
|
+
* Configuration options for the useTableDataHandler hook.
|
|
1049
|
+
* * @interface UseTableDataOptions
|
|
1050
|
+
* @property {string[]} [searchKeys] - Specific object keys to check during client-side filtering. If omitted, defaults to all keys containing string values.
|
|
1051
|
+
* @property {string} [initialSortKey] - The object key to sort the table by on initial render.
|
|
1052
|
+
* @property {SortOrder} [initialSortOrder='asc'] - The initial sorting direction ('asc' or 'desc').
|
|
1053
|
+
* @property {boolean} [isFilterable=true] - Enables or disables client-side searching functionality.
|
|
1054
|
+
* @property {boolean} [isSortable=true] - Enables or disables client-side sorting functionality.
|
|
1055
|
+
* @property {boolean} [isServerSide=false] - If true, bypasses client-side processing, assuming filtering and sorting are handled by an API.
|
|
1056
|
+
*/
|
|
1057
|
+
interface UseTableDataOptions {
|
|
1058
|
+
searchKeys?: string[];
|
|
1059
|
+
initialSortKey?: string;
|
|
1060
|
+
initialSortOrder?: SortOrder;
|
|
1061
|
+
isFilterable?: boolean;
|
|
1062
|
+
isSortable?: boolean;
|
|
1063
|
+
isServerSide?: boolean;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* A custom hook to handle data processing for tables, managing internal states
|
|
1067
|
+
* for client-side filtering (searching) and sorting. It can also safely yield control
|
|
1068
|
+
* to server-side operations if configured.
|
|
1069
|
+
*
|
|
1070
|
+
* ### Key Features:
|
|
1071
|
+
* - **Automatic Key Detection:** Automatically finds string fields to search if no `searchKeys` are provided.
|
|
1072
|
+
* - **Smart Sorting:** Uses `localeCompare` for strings, standard operators for numbers, and gracefully handles `null`/`undefined` values by moving them to the bottom.
|
|
1073
|
+
* - **Server-Side Ready:** Setting `isServerSide: true` disables internal processing while preserving handlers for external API synchronization.
|
|
1074
|
+
*
|
|
1075
|
+
* @param {any[]} initialData - The raw array of data/rows to be displayed in the table.
|
|
1076
|
+
* @param {UseTableDataOptions} [options={}] - Optional configuration flags and initial states.
|
|
1077
|
+
* * @returns {Object} Table state and control handlers.
|
|
1078
|
+
* @returns {any[]} data - The processed array (filtered and sorted) ready for rendering.
|
|
1079
|
+
* @returns {string} searchTerm - The current text being filtered against.
|
|
1080
|
+
* @returns {string|undefined} sortKey - The current object key being used to sort.
|
|
1081
|
+
* @returns {SortOrder} sortOrder - The current direction of the sort ('asc' or 'desc').
|
|
1082
|
+
* @returns {(value: string) => void} handleSearchChange - Callback to update the search filter string.
|
|
1083
|
+
* @returns {(key: string) => void} handleSortChange - Callback to trigger sorting on a specific column. Toggles direction if called on the same column consecutively.
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* const { data, handleSearchChange, handleSortChange } = useTableDataHandler(users, {
|
|
1087
|
+
* searchKeys: ['name', 'email'],
|
|
1088
|
+
* initialSortKey: 'name'
|
|
1089
|
+
* });
|
|
1090
|
+
*/
|
|
1091
|
+
declare const useTableDataHandler: (initialData: any[], options?: UseTableDataOptions) => {
|
|
1092
|
+
data: any[];
|
|
1093
|
+
searchTerm: string;
|
|
1094
|
+
sortKey: string | undefined;
|
|
1095
|
+
sortOrder: SortOrder;
|
|
1096
|
+
handleSearchChange: (value: string) => void;
|
|
1097
|
+
handleSortChange: (key: string) => void;
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
export { Accordions, Alert, Avatar, AlertRoundedSquare as BCAlertRoundedSquare, CubeHeader as BCCubeHeader, Discrepancy as BCDiscrepancy, ExposedPort as BCExposedPort, FQAnalytical as BCFQAnalytical, FQGetaway as BCFQGetaway, FQModeler as BCFQModeler, FQOperation as BCFQOperation, FQWelldone as BCFQWelldone, Flowqount as BCFlowqount, Inlet as BCInlet, Legend as BCLegend, ModalBalance as BCModalBalance, Neutral as BCNeutral, Node as BCNode, Outlet as BCOutlet, Port as BCPort, Rhombus as BCRhombus, SelectAllAdd as BCSelectAllAdd, SelectAllRemove as BCSelectAllRemove, Spinner$1 as BCSpinner, Stack as BCStack, VirtualPort as BCVirtualPort, Badge, Banner, BlockLoading, Brand, Breadcrumb, Button, ButtonApp, Card, Checkbox, Color, ContextualButton, Countdown, DatePicker, Display, Divider, DropdownContainer, DropdownItem, EmptyTable, FileTree, FormGroup, FormGroupButton, FormGroupLabel, FormLabel, Heading, InfoPanel, Link, LiveSearch, MenuContainer, MenuItem, Modal, MonospaceBadge, Notification, P, PaginationBar, PickerCalendar, Pills, Popover, ProgressBar, ProgressCircle, Radio, ResizeableDiv, SegmentButtonGroup, SegmentButtonItem, SelectInput, SidebarContainer, SidebarItem, SidebarMenu, SidebarProfile, Slider, Spinner, Tab, TabMenu, Table, TableBody, TableCell, TableFooterController, TableHead, TableHeaderController, TableRow, TableSearchInput, TagLabel, Text, TextArea, TextInput, Toaster, Toggle, Tooltip, TreeItem, StepperItem as VerticalStepper, Window, getRelativeTime, useFileTree, useTableDataHandler };
|