@wallarm-org/design-system 0.34.1-rc-feature-AS-929-filter-input.1 → 0.34.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/dist/components/BulkBar/BulkBarSummary.d.ts +17 -0
- package/dist/components/BulkBar/BulkBarSummary.js +50 -0
- package/dist/components/BulkBar/classes.d.ts +8 -0
- package/dist/components/BulkBar/classes.js +3 -0
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBarSummary.js +8 -44
- package/dist/components/Selection/classes.js +2 -1
- package/dist/components/Table/TableActionBar/TableActionBar.js +2 -2
- package/dist/components/Table/TableActionBar/TableActionBarSelection.js +7 -49
- package/dist/metadata/components.json +9 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC, Ref } from 'react';
|
|
2
|
+
export interface BulkBarSummaryProps {
|
|
3
|
+
count: number;
|
|
4
|
+
isAllSelected: boolean;
|
|
5
|
+
onSelectAll: () => void;
|
|
6
|
+
onClear: () => void;
|
|
7
|
+
/**
|
|
8
|
+
* When true, prevent the summary from wrapping or being truncated by the
|
|
9
|
+
* container: truncate the "X selected" text and keep the Select-all link on
|
|
10
|
+
* a single line. Use when the bar can shrink (e.g. inside a Drawer).
|
|
11
|
+
* Defaults to `false` — actions then rely on the parent for layout.
|
|
12
|
+
*/
|
|
13
|
+
nowrap?: boolean;
|
|
14
|
+
'data-testid'?: string;
|
|
15
|
+
ref?: Ref<HTMLDivElement>;
|
|
16
|
+
}
|
|
17
|
+
export declare const BulkBarSummary: FC<BulkBarSummaryProps>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Link } from "../Link/index.js";
|
|
4
|
+
import { HStack } from "../Stack/index.js";
|
|
5
|
+
import { Text } from "../Text/index.js";
|
|
6
|
+
const BulkBarSummary = ({ count, isAllSelected, onSelectAll, onClear, nowrap = false, 'data-testid': testId, ref })=>/*#__PURE__*/ jsxs("div", {
|
|
7
|
+
ref: ref,
|
|
8
|
+
"data-slot": "bulk-bar-summary",
|
|
9
|
+
"data-testid": testId,
|
|
10
|
+
className: cn('flex items-center gap-16 p-8', nowrap && 'flex-nowrap whitespace-nowrap'),
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ jsxs(Text, {
|
|
13
|
+
size: "sm",
|
|
14
|
+
color: "primary-alt",
|
|
15
|
+
weight: "medium",
|
|
16
|
+
truncate: nowrap,
|
|
17
|
+
children: [
|
|
18
|
+
count,
|
|
19
|
+
" selected"
|
|
20
|
+
]
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ jsxs(HStack, {
|
|
23
|
+
gap: 6,
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ jsx(Link, {
|
|
26
|
+
type: isAllSelected ? 'muted' : 'alt',
|
|
27
|
+
size: "md",
|
|
28
|
+
onClick: onSelectAll,
|
|
29
|
+
disabled: isAllSelected,
|
|
30
|
+
className: cn(nowrap && 'whitespace-nowrap'),
|
|
31
|
+
children: "Select all"
|
|
32
|
+
}),
|
|
33
|
+
/*#__PURE__*/ jsx(Text, {
|
|
34
|
+
size: "sm",
|
|
35
|
+
color: "tertiary-alt",
|
|
36
|
+
weight: "medium",
|
|
37
|
+
children: "\xb7"
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ jsx(Link, {
|
|
40
|
+
type: "alt",
|
|
41
|
+
size: "md",
|
|
42
|
+
onClick: onClear,
|
|
43
|
+
children: "Clear"
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
BulkBarSummary.displayName = 'BulkBarSummary';
|
|
50
|
+
export { BulkBarSummary };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual surface shared between the page-level Selection bulk bar and the
|
|
3
|
+
* Table action bar: background, rounded corners, padding, and the
|
|
4
|
+
* `data-[state=open|closed]` enter/exit animation pair. Consumers compose
|
|
5
|
+
* this onto whatever element acts as the bar's outer container — a plain
|
|
6
|
+
* `<div>` (when driven by `Presence`) or a `Popover.Content`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const bulkBarSurfaceClasses: string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
const bulkBarSurfaceClasses = cn('bg-component-toast-bg rounded-16 shadow-lg', 'pl-12 pr-8 py-8', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-bottom data-[state=open]:duration-300', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-bottom data-[state=closed]:duration-150');
|
|
3
|
+
export { bulkBarSurfaceClasses };
|
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTestId } from "../../../utils/testId.js";
|
|
3
|
-
import {
|
|
4
|
-
import { HStack } from "../../Stack/index.js";
|
|
5
|
-
import { Text } from "../../Text/index.js";
|
|
3
|
+
import { BulkBarSummary } from "../../BulkBar/BulkBarSummary.js";
|
|
6
4
|
import { useSelectionContext } from "../useSelectionContext.js";
|
|
7
5
|
const SelectionBulkBarSummary = ()=>{
|
|
8
6
|
const { isAllSelected, selectedIds, selectAll, clear } = useSelectionContext();
|
|
9
7
|
const testId = useTestId('bulk-bar-summary');
|
|
10
|
-
|
|
11
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
8
|
+
return /*#__PURE__*/ jsx(BulkBarSummary, {
|
|
12
9
|
"data-testid": testId,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
weight: "medium",
|
|
19
|
-
truncate: true,
|
|
20
|
-
children: [
|
|
21
|
-
count,
|
|
22
|
-
" selected"
|
|
23
|
-
]
|
|
24
|
-
}),
|
|
25
|
-
/*#__PURE__*/ jsxs(HStack, {
|
|
26
|
-
gap: 6,
|
|
27
|
-
children: [
|
|
28
|
-
/*#__PURE__*/ jsx(Link, {
|
|
29
|
-
type: isAllSelected ? 'muted' : 'alt',
|
|
30
|
-
size: "md",
|
|
31
|
-
onClick: selectAll,
|
|
32
|
-
disabled: isAllSelected,
|
|
33
|
-
className: "whitespace-nowrap",
|
|
34
|
-
children: "Select all"
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ jsx(Text, {
|
|
37
|
-
size: "sm",
|
|
38
|
-
color: "tertiary-alt",
|
|
39
|
-
weight: "medium",
|
|
40
|
-
children: "\xb7"
|
|
41
|
-
}),
|
|
42
|
-
/*#__PURE__*/ jsx(Link, {
|
|
43
|
-
type: "alt",
|
|
44
|
-
size: "md",
|
|
45
|
-
onClick: clear,
|
|
46
|
-
children: "Clear"
|
|
47
|
-
})
|
|
48
|
-
]
|
|
49
|
-
})
|
|
50
|
-
]
|
|
10
|
+
count: selectedIds.size,
|
|
11
|
+
isAllSelected: isAllSelected,
|
|
12
|
+
onSelectAll: selectAll,
|
|
13
|
+
onClear: clear,
|
|
14
|
+
nowrap: true
|
|
51
15
|
});
|
|
52
16
|
};
|
|
53
17
|
SelectionBulkBarSummary.displayName = 'SelectionBulkBarSummary';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { bulkBarSurfaceClasses } from "../BulkBar/classes.js";
|
|
3
4
|
const selectionItemVariants = cva('flex w-full min-w-0 items-start gap-12');
|
|
4
|
-
const selectionBulkBarVariants = cva(cn('z-[200] flex w-fit flex-nowrap items-center gap-16',
|
|
5
|
+
const selectionBulkBarVariants = cva(cn('z-[200] flex w-fit flex-nowrap items-center gap-16', bulkBarSurfaceClasses, '[&_button]:shrink-0 [&_button]:whitespace-nowrap'), {
|
|
5
6
|
variants: {
|
|
6
7
|
placement: {
|
|
7
8
|
absolute: 'absolute bottom-12 left-1/2 -translate-x-1/2 max-w-[calc(100%-48px)]',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from "@ark-ui/react/popover";
|
|
3
3
|
import { Portal } from "@ark-ui/react/portal";
|
|
4
|
-
import { cn } from "../../../utils/cn.js";
|
|
5
4
|
import { useTestId } from "../../../utils/testId.js";
|
|
5
|
+
import { bulkBarSurfaceClasses } from "../../BulkBar/classes.js";
|
|
6
6
|
import { HStack } from "../../Stack/index.js";
|
|
7
7
|
import { TableActionBarSelection } from "./TableActionBarSelection.js";
|
|
8
8
|
const TableActionBar = ({ children })=>{
|
|
@@ -14,7 +14,7 @@ const TableActionBar = ({ children })=>{
|
|
|
14
14
|
},
|
|
15
15
|
children: /*#__PURE__*/ jsx(Popover.Content, {
|
|
16
16
|
"data-testid": testId,
|
|
17
|
-
className:
|
|
17
|
+
className: bulkBarSurfaceClasses,
|
|
18
18
|
children: /*#__PURE__*/ jsxs(HStack, {
|
|
19
19
|
gap: 40,
|
|
20
20
|
align: "center",
|
|
@@ -1,58 +1,16 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTestId } from "../../../utils/testId.js";
|
|
3
|
-
import {
|
|
4
|
-
import { HStack } from "../../Stack/index.js";
|
|
5
|
-
import { Text } from "../../Text/index.js";
|
|
3
|
+
import { BulkBarSummary } from "../../BulkBar/BulkBarSummary.js";
|
|
6
4
|
import { useTableContext } from "../TableContext/index.js";
|
|
7
5
|
const TableActionBarSelection = ()=>{
|
|
8
6
|
const { table } = useTableContext();
|
|
9
7
|
const testId = useTestId('action-bar-selection');
|
|
10
|
-
|
|
11
|
-
const allSelected = table.getIsAllRowsSelected();
|
|
12
|
-
const handleSelectAll = ()=>{
|
|
13
|
-
table.toggleAllRowsSelected(true);
|
|
14
|
-
};
|
|
15
|
-
const handleClear = ()=>{
|
|
16
|
-
table.resetRowSelection();
|
|
17
|
-
};
|
|
18
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
8
|
+
return /*#__PURE__*/ jsx(BulkBarSummary, {
|
|
19
9
|
"data-testid": testId,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
color: "primary-alt",
|
|
25
|
-
weight: "medium",
|
|
26
|
-
children: [
|
|
27
|
-
count,
|
|
28
|
-
" selected"
|
|
29
|
-
]
|
|
30
|
-
}),
|
|
31
|
-
/*#__PURE__*/ jsxs(HStack, {
|
|
32
|
-
gap: 6,
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ jsx(Link, {
|
|
35
|
-
type: allSelected ? 'muted' : 'alt',
|
|
36
|
-
size: "md",
|
|
37
|
-
onClick: handleSelectAll,
|
|
38
|
-
disabled: allSelected,
|
|
39
|
-
children: "Select all"
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ jsx(Text, {
|
|
42
|
-
size: "sm",
|
|
43
|
-
color: "tertiary-alt",
|
|
44
|
-
weight: "medium",
|
|
45
|
-
children: "\xb7"
|
|
46
|
-
}),
|
|
47
|
-
/*#__PURE__*/ jsx(Link, {
|
|
48
|
-
type: "alt",
|
|
49
|
-
size: "md",
|
|
50
|
-
onClick: handleClear,
|
|
51
|
-
children: "Clear"
|
|
52
|
-
})
|
|
53
|
-
]
|
|
54
|
-
})
|
|
55
|
-
]
|
|
10
|
+
count: Object.keys(table.getState().rowSelection).length,
|
|
11
|
+
isAllSelected: table.getIsAllRowsSelected(),
|
|
12
|
+
onSelectAll: ()=>table.toggleAllRowsSelected(true),
|
|
13
|
+
onClear: ()=>table.resetRowSelection()
|
|
56
14
|
});
|
|
57
15
|
};
|
|
58
16
|
TableActionBarSelection.displayName = 'TableActionBarSelection';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.34.0",
|
|
3
|
-
"generatedAt": "2026-05-
|
|
3
|
+
"generatedAt": "2026-05-12T08:10:24.915Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Alert",
|
|
@@ -6044,6 +6044,14 @@
|
|
|
6044
6044
|
}
|
|
6045
6045
|
]
|
|
6046
6046
|
},
|
|
6047
|
+
{
|
|
6048
|
+
"name": "BulkBar",
|
|
6049
|
+
"importPath": "@wallarm-org/design-system/BulkBar",
|
|
6050
|
+
"props": [],
|
|
6051
|
+
"variants": [],
|
|
6052
|
+
"subComponents": [],
|
|
6053
|
+
"examples": []
|
|
6054
|
+
},
|
|
6047
6055
|
{
|
|
6048
6056
|
"name": "Button",
|
|
6049
6057
|
"importPath": "@wallarm-org/design-system/Button",
|
package/package.json
CHANGED