@talogic/react 0.9.0 → 0.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/index.js +728 -611
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/talogic-react.css +1 -1
- package/tokens.css +6 -0
- package/ui/button/button.recipe.d.ts +4 -0
- package/ui/navigation/tabs.component.d.ts +13 -5
- package/ui/selectable-list/bulk-action-bar.component.d.ts +6 -4
- package/ui/selectable-list/index.d.ts +3 -1
- package/ui/selectable-list/select-all-checkbox.component.d.ts +18 -4
- package/ui/selectable-list/selection-header.component.d.ts +28 -0
|
@@ -10,17 +10,19 @@ export interface BulkActionBarProps {
|
|
|
10
10
|
countLabel?: (count: number) => ReactNode;
|
|
11
11
|
/** The accessible name of the toolbar. */
|
|
12
12
|
label?: string;
|
|
13
|
+
/** Shows a button that clears the selection. Turn it off where the select-all checkbox is beside the bar. */
|
|
14
|
+
clearable?: boolean;
|
|
13
15
|
/** The accessible name of the button that clears the selection. */
|
|
14
16
|
clearLabel?: string;
|
|
15
17
|
/** Extra classes for the root. */
|
|
16
18
|
className?: string;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
|
-
* The toolbar of a selectable list while some items are selected: the count, the actions the product passes in, and
|
|
20
|
-
* button that clears the selection. It sticks to the top of the scrolling area, so it
|
|
21
|
-
* scrolls. It shows nothing when no item is selected.
|
|
21
|
+
* The toolbar of a selectable list while some items are selected: the count, the actions the product passes in, and
|
|
22
|
+
* (unless `clearable` is off) a button that clears the selection. It sticks to the top of the scrolling area, so it
|
|
23
|
+
* stays in view while the list scrolls. It shows nothing when no item is selected.
|
|
22
24
|
*
|
|
23
25
|
* @param props - The selection, the actions and the labels.
|
|
24
26
|
* @returns The toolbar, or nothing.
|
|
25
27
|
*/
|
|
26
|
-
export declare function BulkActionBar({ selection, children, countLabel, label, clearLabel, className }: BulkActionBarProps): import("react").JSX.Element | null;
|
|
28
|
+
export declare function BulkActionBar({ selection, children, countLabel, label, clearable, clearLabel, className }: BulkActionBarProps): import("react").JSX.Element | null;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { BulkActionBar } from './bulk-action-bar.component';
|
|
2
2
|
export type { BulkActionBarProps } from './bulk-action-bar.component';
|
|
3
3
|
export { SelectAllCheckbox } from './select-all-checkbox.component';
|
|
4
|
-
export type { SelectAllCheckboxProps } from './select-all-checkbox.component';
|
|
4
|
+
export type { SelectAllCheckboxProps, SelectionFilter } from './select-all-checkbox.component';
|
|
5
|
+
export { SelectionHeader } from './selection-header.component';
|
|
6
|
+
export type { SelectionHeaderProps } from './selection-header.component';
|
|
5
7
|
export { SelectableList, SelectableRow } from './selectable-list.component';
|
|
6
8
|
export type { SelectableListProps, SelectableRowProps } from './selectable-list.component';
|
|
7
9
|
export { useSelection } from './selection.hook';
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { Selection } from './selection.hook';
|
|
3
|
+
/** A row of the {@link SelectAllCheckbox} menu that selects exactly the items that match it, such as "Unread". */
|
|
4
|
+
export interface SelectionFilter {
|
|
5
|
+
/** The text of the menu row. It must be unique in the menu. */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Tells if an item belongs to the filter.
|
|
9
|
+
*
|
|
10
|
+
* @param id - The id of an item of the list.
|
|
11
|
+
* @returns `true` to select the item.
|
|
12
|
+
*/
|
|
13
|
+
match: (id: string) => boolean;
|
|
14
|
+
}
|
|
3
15
|
/** Props of {@link SelectAllCheckbox}. */
|
|
4
16
|
export interface SelectAllCheckboxProps {
|
|
5
17
|
/** The selection of the list. */
|
|
6
18
|
selection: Selection;
|
|
7
|
-
/**
|
|
19
|
+
/** Menu rows after "All" and "None". Each one replaces the selection with the items that match it. */
|
|
20
|
+
filters?: readonly SelectionFilter[];
|
|
21
|
+
/** Extra menu rows after the filters, for example a `DropdownMenuItem` with its own action. */
|
|
8
22
|
children?: ReactNode;
|
|
9
23
|
/** The accessible name of the checkbox. */
|
|
10
24
|
label?: string;
|
|
@@ -20,9 +34,9 @@ export interface SelectAllCheckboxProps {
|
|
|
20
34
|
/**
|
|
21
35
|
* The header checkbox of a selectable list, with a menu. The checkbox is checked when all items are selected and
|
|
22
36
|
* indeterminate when some are. A click selects all when none is selected, and clears the selection otherwise. The
|
|
23
|
-
* menu has "All", "None" and the rows the product passes in.
|
|
37
|
+
* menu has "All", "None", the filters and the rows the product passes in.
|
|
24
38
|
*
|
|
25
|
-
* @param props - The selection, the extra menu rows and the labels.
|
|
39
|
+
* @param props - The selection, the filters, the extra menu rows and the labels.
|
|
26
40
|
* @returns The checkbox and its menu button.
|
|
27
41
|
*/
|
|
28
|
-
export declare function SelectAllCheckbox({ selection, children, label, menuLabel, allLabel, noneLabel, className }: SelectAllCheckboxProps): import("react").JSX.Element;
|
|
42
|
+
export declare function SelectAllCheckbox({ selection, filters, children, label, menuLabel, allLabel, noneLabel, className }: SelectAllCheckboxProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SelectionFilter } from './select-all-checkbox.component';
|
|
3
|
+
import type { Selection } from './selection.hook';
|
|
4
|
+
/** Props of {@link SelectionHeader}. */
|
|
5
|
+
export interface SelectionHeaderProps {
|
|
6
|
+
/** The selection of the list. */
|
|
7
|
+
selection: Selection;
|
|
8
|
+
/** The actions for the selected items, for example buttons. They show only while some items are selected. */
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
/** The menu rows of the header checkbox after "All" and "None", such as "Read" and "Unread". */
|
|
11
|
+
filters?: readonly SelectionFilter[];
|
|
12
|
+
/** What the row shows while nothing is selected, for example "24 situations". */
|
|
13
|
+
summary?: ReactNode;
|
|
14
|
+
/** The text of the count. Default: "3 selected". */
|
|
15
|
+
countLabel?: (count: number) => ReactNode;
|
|
16
|
+
/** Extra classes for the root. */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The header row of a selectable list, in the Gmail layout: the header checkbox and its menu always stay at the start
|
|
21
|
+
* of the row, and the count and the actions show to its right while some items are selected. The checkbox also clears
|
|
22
|
+
* the selection, so the row has no separate clear button. The row does not move or
|
|
23
|
+
* change height when the selection changes. It sticks to the top of the scrolling area.
|
|
24
|
+
*
|
|
25
|
+
* @param props - The selection, the actions, the filters and the summary.
|
|
26
|
+
* @returns The header row.
|
|
27
|
+
*/
|
|
28
|
+
export declare function SelectionHeader({ selection, actions, filters, summary, countLabel, className }: SelectionHeaderProps): import("react").JSX.Element;
|