@bloomreach/react-banana-ui 1.9.1 → 1.11.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/bloomreach-react-banana-ui.es.js +4383 -3986
- package/dist/bloomreach-react-banana-ui.es.js.map +1 -1
- package/dist/bloomreach-react-banana-ui.umd.js +14 -14
- package/dist/bloomreach-react-banana-ui.umd.js.map +1 -1
- package/dist/components/data-display/asset-tag/asset-tag.d.ts +20 -0
- package/dist/components/data-display/asset-tag/asset-tag.qa.stories.d.ts +5 -0
- package/dist/components/data-display/asset-tag/asset-tag.stories.d.ts +7 -0
- package/dist/components/data-display/asset-tag/asset-tag.types.d.ts +31 -0
- package/dist/components/data-display/asset-tag/index.d.ts +2 -0
- package/dist/components/data-display/filter-tag/filter-tag.d.ts +18 -0
- package/dist/components/data-display/filter-tag/filter-tag.qa.stories.d.ts +5 -0
- package/dist/components/data-display/filter-tag/filter-tag.stories.d.ts +7 -0
- package/dist/components/data-display/filter-tag/filter-tag.types.d.ts +29 -0
- package/dist/components/data-display/filter-tag/index.d.ts +2 -0
- package/dist/components/data-display/index.d.ts +12 -0
- package/dist/components/data-display/input-tag/index.d.ts +2 -0
- package/dist/components/data-display/input-tag/input-tag.d.ts +18 -0
- package/dist/components/data-display/input-tag/input-tag.qa.stories.d.ts +5 -0
- package/dist/components/data-display/input-tag/input-tag.stories.d.ts +9 -0
- package/dist/components/data-display/input-tag/input-tag.types.d.ts +50 -0
- package/dist/components/data-display/internal.d.ts +1 -0
- package/dist/components/data-display/table/index.d.ts +2 -0
- package/dist/components/data-display/table/table-context.d.ts +5 -0
- package/dist/components/data-display/table/table-section-context.d.ts +5 -0
- package/dist/components/data-display/table/table.d.ts +57 -0
- package/dist/components/data-display/table/table.qa.stories.d.ts +8 -0
- package/dist/components/data-display/table/table.stories.d.ts +12 -0
- package/dist/components/data-display/table/table.types.d.ts +21 -0
- package/dist/components/data-display/table-body/index.d.ts +2 -0
- package/dist/components/data-display/table-body/table-body.d.ts +24 -0
- package/dist/components/data-display/table-body/table-body.types.d.ts +11 -0
- package/dist/components/data-display/table-cell/index.d.ts +2 -0
- package/dist/components/data-display/table-cell/table-cell.d.ts +37 -0
- package/dist/components/data-display/table-cell/table-cell.types.d.ts +13 -0
- package/dist/components/data-display/table-cell-action/index.d.ts +2 -0
- package/dist/components/data-display/table-cell-action/table-cell-action.d.ts +30 -0
- package/dist/components/data-display/table-cell-action/table-cell-action.types.d.ts +11 -0
- package/dist/components/data-display/table-foot/index.d.ts +2 -0
- package/dist/components/data-display/table-foot/table-foot.d.ts +24 -0
- package/dist/components/data-display/table-foot/table-foot.types.d.ts +17 -0
- package/dist/components/data-display/table-head/index.d.ts +2 -0
- package/dist/components/data-display/table-head/table-head.d.ts +24 -0
- package/dist/components/data-display/table-head/table-head.types.d.ts +11 -0
- package/dist/components/data-display/table-row/index.d.ts +2 -0
- package/dist/components/data-display/table-row/table-row-context.d.ts +5 -0
- package/dist/components/data-display/table-row/table-row.d.ts +32 -0
- package/dist/components/data-display/table-row/table-row.types.d.ts +28 -0
- package/dist/components/data-display/table-sort-label/index.d.ts +2 -0
- package/dist/components/data-display/table-sort-label/table-sort-label.d.ts +26 -0
- package/dist/components/data-display/table-sort-label/table-sort-label.types.d.ts +20 -0
- package/dist/components/data-display/tag/index.d.ts +2 -0
- package/dist/components/data-display/tag/tag.d.ts +13 -0
- package/dist/components/data-display/tag/tag.types.d.ts +45 -0
- package/dist/components/data-display/tag-group/index.d.ts +2 -0
- package/dist/components/data-display/tag-group/tag-group.d.ts +24 -0
- package/dist/components/data-display/tag-group/tag-group.qa.stories.d.ts +5 -0
- package/dist/components/data-display/tag-group/tag-group.stories.d.ts +8 -0
- package/dist/components/data-display/tag-group/tag-group.types.d.ts +11 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/utils/hooks/use-hover.d.ts +6 -5
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AssetTagProps } from './asset-tag.types';
|
|
3
|
+
import './asset-tag.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The purpose of this component is the visual differentiation of a particular element
|
|
6
|
+
* on the screen (for example table row). Users can set a custom color for each custom tag
|
|
7
|
+
* to visually distinguish it from the rest, for better organisation.
|
|
8
|
+
*
|
|
9
|
+
* ### Usage
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { AssetTag } from '@bloomreach/react-banana-ui';
|
|
13
|
+
*
|
|
14
|
+
* export default function MyCustomComponent() {
|
|
15
|
+
* return <AssetTag>Banana</AssetTag>;
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const AssetTag: import("react").ForwardRefExoticComponent<AssetTagProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export default AssetTag;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import AssetTag from './asset-tag';
|
|
3
|
+
declare const meta: Meta<typeof AssetTag>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export type Story = StoryObj<typeof AssetTag>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const AllVariants: Story;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface AssetTagProps {
|
|
3
|
+
/**
|
|
4
|
+
* The content of the component.
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Custom class name for the container of the component.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Variant of tag.
|
|
13
|
+
* @default 'default'
|
|
14
|
+
*/
|
|
15
|
+
variant?: AssetTagVariant;
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the tag can be dismissed by clicking on close icon.
|
|
18
|
+
* Removing of the tag needs to be handled by the user using `onDismiss`.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
dismissible?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Callback fired when tag is closed or dismissed.
|
|
24
|
+
*/
|
|
25
|
+
onDismiss?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Display an icon at the beginning of the tag.
|
|
28
|
+
*/
|
|
29
|
+
icon?: ReactElement;
|
|
30
|
+
}
|
|
31
|
+
export type AssetTagVariant = 'default' | 'accent-1' | 'accent-2' | 'accent-3' | 'accent-4' | 'accent-5' | 'accent-6' | 'accent-7' | 'accent-8' | 'accent-9';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FilterTagProps } from './filter-tag.types';
|
|
3
|
+
import './filter-tag.scss';
|
|
4
|
+
/**
|
|
5
|
+
* Filter tags are interactive labels used to filter criteria.
|
|
6
|
+
*
|
|
7
|
+
* ### Usage
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { FilterTag } from '@bloomreach/react-banana-ui';
|
|
11
|
+
*
|
|
12
|
+
* export default function MyCustomComponent() {
|
|
13
|
+
* return <FilterTag>Name</FilterTag>;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const FilterTag: import("react").ForwardRefExoticComponent<FilterTagProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default FilterTag;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import FilterTag from './filter-tag';
|
|
3
|
+
declare const meta: Meta<typeof FilterTag>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export type Story = StoryObj<typeof FilterTag>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Controlled: Story;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface FilterTagProps {
|
|
3
|
+
/**
|
|
4
|
+
* The content of the component.
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Custom class name for the container of the component.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Allows to control whether the tag is selected.
|
|
13
|
+
* This is a controlled counterpart of `defaultSelected`
|
|
14
|
+
*/
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the tag is initially selected.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
defaultSelected?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Callback fired when tag's selection changes
|
|
23
|
+
*/
|
|
24
|
+
onChange?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>, selected: boolean) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Display an icon at the beginning of the tag.
|
|
27
|
+
*/
|
|
28
|
+
icon?: ReactElement;
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './asset-tag';
|
|
2
|
+
export * from './filter-tag';
|
|
3
|
+
export * from './input-tag';
|
|
4
|
+
export * from './table-body';
|
|
5
|
+
export * from './table-cell-action';
|
|
6
|
+
export * from './table-cell';
|
|
7
|
+
export * from './table-foot';
|
|
8
|
+
export * from './table-head';
|
|
9
|
+
export * from './table-row';
|
|
10
|
+
export * from './table-sort-label';
|
|
11
|
+
export * from './table';
|
|
12
|
+
export * from './tag-group';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { InputTagProps } from './input-tag.types';
|
|
3
|
+
import './input-tag.scss';
|
|
4
|
+
/**
|
|
5
|
+
* Input tags are used in auto complete and search inputs.
|
|
6
|
+
*
|
|
7
|
+
* ### Usage
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { InputTag } from '@bloomreach/react-banana-ui';
|
|
11
|
+
*
|
|
12
|
+
* export default function MyCustomComponent() {
|
|
13
|
+
* return <InputTag>Banana</InputTag>;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const InputTag: import("react").ForwardRefExoticComponent<InputTagProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default InputTag;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import InputTag from './input-tag';
|
|
3
|
+
declare const meta: Meta<typeof InputTag>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export type Story = StoryObj<typeof InputTag>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Controlled: Story;
|
|
8
|
+
export declare const AllStates: Story;
|
|
9
|
+
export declare const AllStatesWithIcon: Story;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface InputTagProps {
|
|
3
|
+
/**
|
|
4
|
+
* The content of the component.
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Custom class name for the container of the component.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Allows to control whether the tag is selected.
|
|
13
|
+
* This is a controlled counterpart of `defaultSelected`
|
|
14
|
+
*/
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the tag is initially selected.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
defaultSelected?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Callback fired when tag's selection changes.
|
|
23
|
+
*/
|
|
24
|
+
onChange?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>, selected: boolean) => void;
|
|
25
|
+
/**
|
|
26
|
+
* If `true`, the tag can be dismissed by clicking on close icon.
|
|
27
|
+
* Removing of the tag needs to be handled by the user using `onDismiss`.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
dismissible?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, the tag is disabled.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If `true`, the tag is not interactable but can be dismissible.
|
|
38
|
+
* The state should not change on click.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
readOnly?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback fired when tag is closed or dismissed.
|
|
44
|
+
*/
|
|
45
|
+
onDismiss?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Display an icon at the beginning of the tag.
|
|
48
|
+
*/
|
|
49
|
+
icon?: ReactElement;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tag';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableContextProps } from './table.types';
|
|
3
|
+
declare const TableContext: import("react").Context<TableContextProps | null>;
|
|
4
|
+
export declare function useTableContext(): TableContextProps | null;
|
|
5
|
+
export default TableContext;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableSectionContextProps } from './table.types';
|
|
3
|
+
declare const TableSectionContext: import("react").Context<TableSectionContextProps | null>;
|
|
4
|
+
export declare function useTableSectionContext(): TableSectionContextProps | null;
|
|
5
|
+
export default TableSectionContext;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableProps } from './table.types';
|
|
3
|
+
import './table.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The components like `Table`, `TableHead`, `TableBody`, `TableRow`, `TableCell` etc.
|
|
6
|
+
* are wrappers for the HTML table elements `table`, `thead`, `tbody`, `tr`, `th`, `td` etc.
|
|
7
|
+
* These components are used to build a table in a more structured way and can accept all based props.
|
|
8
|
+
*
|
|
9
|
+
* A table displays data in rows and columns. They can be fully customized.
|
|
10
|
+
* The table displays information in a way that's easy to scan so that users can look for patterns and insights.
|
|
11
|
+
* They can be embedded in primary content. They can include:
|
|
12
|
+
* - A corresponding visualization
|
|
13
|
+
* - Pagination
|
|
14
|
+
* - Tools to query and manipulate data
|
|
15
|
+
*
|
|
16
|
+
* ### Usage
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { Table, TableHeader, TableBody, TableFoot, TableCell } from '@bloomreach/react-banana-ui';
|
|
20
|
+
*
|
|
21
|
+
* export default function CustomStaticTable() {
|
|
22
|
+
* return (
|
|
23
|
+
* <Table>
|
|
24
|
+
* <TableHeader>
|
|
25
|
+
* <TableRow>
|
|
26
|
+
* <TableCell>#</TableCell>
|
|
27
|
+
* </TableRow>
|
|
28
|
+
* <TableRow>
|
|
29
|
+
* <TableCell>Name</TableCell>
|
|
30
|
+
* </TableRow>
|
|
31
|
+
* </TableHeader>
|
|
32
|
+
* <TableBody>
|
|
33
|
+
* <TableRow>
|
|
34
|
+
* <TableCell>0</TableCell>
|
|
35
|
+
* <TableCell>Foo</TableCell>
|
|
36
|
+
* </TableRow>
|
|
37
|
+
* <TableRow>
|
|
38
|
+
* <TableCell>1</TableCell>
|
|
39
|
+
* <TableCell>Bar</TableCell>
|
|
40
|
+
* </TableRow>
|
|
41
|
+
* <TableRow>
|
|
42
|
+
* <TableCell>2</TableCell>
|
|
43
|
+
* <TableCell>Baz</TableCell>
|
|
44
|
+
* </TableRow>
|
|
45
|
+
* </TableBody>
|
|
46
|
+
* <TableFoot>
|
|
47
|
+
* <TableRow>
|
|
48
|
+
* <TableCell colSpan={2}>This table has 3 rows</TableCell>
|
|
49
|
+
* </TableRow>
|
|
50
|
+
* </TableFoot>
|
|
51
|
+
* </Table>
|
|
52
|
+
* );
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare const Table: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<HTMLTableElement>>;
|
|
57
|
+
export default Table;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { type Story } from './table.stories';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Basic: Story;
|
|
6
|
+
export declare const Sortable: Story;
|
|
7
|
+
export declare const WithPagination: Story;
|
|
8
|
+
export declare const WithRowAction: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Table from './table';
|
|
3
|
+
declare const meta: Meta<typeof Table>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export type Story = StoryObj<typeof Table>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Sortable: Story;
|
|
8
|
+
export declare const WithPagination: Story;
|
|
9
|
+
export declare const WithBulkActions: Story;
|
|
10
|
+
export declare const WithRowAction: Story;
|
|
11
|
+
export declare const ExpandableRows: Story;
|
|
12
|
+
export declare const Searchable: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
type TableRowDensity = 'small' | 'medium' | 'large';
|
|
3
|
+
export interface TableContextProps {
|
|
4
|
+
rowDensity: TableRowDensity;
|
|
5
|
+
}
|
|
6
|
+
export interface TableSectionContextProps {
|
|
7
|
+
variant: 'head' | 'body' | 'foot';
|
|
8
|
+
hasPagination?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TableProps extends HTMLAttributes<HTMLTableElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Custom class name for the container of the component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The content of the component.
|
|
17
|
+
*/
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
rowDensity?: TableRowDensity;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableBodyProps } from './table-body.types';
|
|
3
|
+
import './table-body.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The component renders a `<tbody>` element and it should contain `TableRow` components.
|
|
6
|
+
*
|
|
7
|
+
* ### Usage
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { Table, TableBody, TableRow, TableCell } from '@bloomreach/react-banana-ui';
|
|
11
|
+
*
|
|
12
|
+
* export default function MyCustomBody() {
|
|
13
|
+
* return (
|
|
14
|
+
* <TableBody className="custom-body">
|
|
15
|
+
* <TableRow>
|
|
16
|
+
* <TableCell>This cell will be rendered as `<td>`</TableCell>
|
|
17
|
+
* </TableRow>
|
|
18
|
+
* </TableBody>
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const TableBody: import("react").ForwardRefExoticComponent<TableBodyProps & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
24
|
+
export default TableBody;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export interface TableBodyProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Custom class name for the container of the component.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The content of the component, normally `TableRow`.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableCellProps } from './table-cell.types';
|
|
3
|
+
import './table-cell.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The component renders a `<th>` element when the parent context is a header
|
|
6
|
+
* or otherwise a `<td>` element.
|
|
7
|
+
*
|
|
8
|
+
* ### Usage
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Table, TableHeader, TableBody, TableFoot, TableCell } from '@bloomreach/react-banana-ui';
|
|
12
|
+
*
|
|
13
|
+
* export default function MyCustomTable() {
|
|
14
|
+
* return (
|
|
15
|
+
* <Table>
|
|
16
|
+
* <TableHeader>
|
|
17
|
+
* <TableRow>
|
|
18
|
+
* <TableCell>This cell will be rendered as `<th>`</TableCell>
|
|
19
|
+
* </TableRow>
|
|
20
|
+
* </TableHeader>
|
|
21
|
+
* <TableBody>
|
|
22
|
+
* <TableRow>
|
|
23
|
+
* <TableCell>This cell will be rendered as `<td>`</TableCell>
|
|
24
|
+
* </TableRow>
|
|
25
|
+
* </TableBody>
|
|
26
|
+
* <TableFoot>
|
|
27
|
+
* <TableRow>
|
|
28
|
+
* <TableCell>This cell will be rendered as `<td>`</TableCell>
|
|
29
|
+
* </TableRow>
|
|
30
|
+
* </TableFoot>
|
|
31
|
+
* </Table>
|
|
32
|
+
* );
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
37
|
+
export default TableCell;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
2
|
+
type TableCellBaseProps = ThHTMLAttributes<HTMLTableCellElement> & TdHTMLAttributes<HTMLTableCellElement>;
|
|
3
|
+
export interface TableCellProps extends TableCellBaseProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom class name for the container of the component.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The content of the component.
|
|
10
|
+
*/
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableCellActionProps } from './table-cell-action.types';
|
|
3
|
+
import './table-cell-action.scss';
|
|
4
|
+
/**
|
|
5
|
+
* This component renders content in a table cell when a row is hovered or focused.
|
|
6
|
+
* It should be used only inside `<TableRow>` component.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* ### Usage
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { TableCellAction } from '@bloomreach/react-banana-ui';
|
|
13
|
+
*
|
|
14
|
+
* export default function RowWithAction() {
|
|
15
|
+
* return (
|
|
16
|
+
* <TableRow key={row.id}>
|
|
17
|
+
* <TableCell>Foo</TableCell>
|
|
18
|
+
* <TableCell>Bar</TableCell>
|
|
19
|
+
* <TableCell>
|
|
20
|
+
* <TableCellAction>
|
|
21
|
+
* <Button onClick={() => console.log('Edit')}>Edit</Button>
|
|
22
|
+
* </TableCellAction>
|
|
23
|
+
* </TableCell>
|
|
24
|
+
* </TableRow>
|
|
25
|
+
* );
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const TableCellAction: import("react").ForwardRefExoticComponent<TableCellActionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export default TableCellAction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TableCellActionProps {
|
|
3
|
+
/**
|
|
4
|
+
* Custom class name for the container of the component.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The content of the component, usually a <Button>, <MenuButton> or <ButtonGroup>.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableFootProps } from './table-foot.types';
|
|
3
|
+
import './table-foot.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The component renders a `<tfoot>` element and should contain `TableRow` components.
|
|
6
|
+
*
|
|
7
|
+
* ### Usage
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { TableFoot, TableRow, TableCell } from '@bloomreach/react-banana-ui';
|
|
11
|
+
*
|
|
12
|
+
* export default function MyCustomTableFooter() {
|
|
13
|
+
* return (
|
|
14
|
+
* <TableFoot className="custom-footer">
|
|
15
|
+
* <TableRow>
|
|
16
|
+
* <TableCell>This cell will be rendered as `<td>`</TableCell>
|
|
17
|
+
* </TableRow>
|
|
18
|
+
* </TableFoot>
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const TableFoot: import("react").ForwardRefExoticComponent<TableFootProps & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
24
|
+
export default TableFoot;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TableFootProps {
|
|
3
|
+
/**
|
|
4
|
+
* Custom class name for the container of the component.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The content of the component, normally `TableRow`.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Indicates if the table has pagination.
|
|
13
|
+
* If `true`, the component will add a CSS class to the `TableCell` to apply specific styles.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
hasPagination?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableHeadProps } from './table-head.types';
|
|
3
|
+
import './table-head.scss';
|
|
4
|
+
/**
|
|
5
|
+
* The component renders a `<thead>` element and it should contain `TableRow` components.
|
|
6
|
+
*
|
|
7
|
+
* ### Usage
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { TableHead, TableRow, TableCell } from '@bloomreach/react-banana-ui';
|
|
11
|
+
*
|
|
12
|
+
* export default function MyCustomHead() {
|
|
13
|
+
* return (
|
|
14
|
+
* <TableHead className="custom-head">
|
|
15
|
+
* <TableRow>
|
|
16
|
+
* <TableCell>This cell will be rendered as `<th>`</TableCell>
|
|
17
|
+
* </TableRow>
|
|
18
|
+
* </TableHead>
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const TableHead: import("react").ForwardRefExoticComponent<TableHeadProps & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
24
|
+
export default TableHead;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TableHeadProps extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Custom class name for the container of the component.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The content of the component, normally `TableRow`.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableRowContextProps } from './table-row.types';
|
|
3
|
+
declare const TableRowContext: import("react").Context<TableRowContextProps | null>;
|
|
4
|
+
export declare function useTableRowContext(): TableRowContextProps | null;
|
|
5
|
+
export default TableRowContext;
|