@wallarm-org/design-system 0.34.0 → 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.
@@ -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 };
@@ -27,6 +27,5 @@ export declare const useChipEditing: ({ conditions, chips, fields, containerRef,
27
27
  resetSegmentTyping: () => void;
28
28
  handleChipClick: (chipId: string, segment: ChipSegment, anchorRect: DOMRect) => void;
29
29
  clearEditing: () => void;
30
- cancelSegmentEdit: () => void;
31
30
  };
32
31
  export {};
@@ -61,24 +61,12 @@ const useChipEditing = ({ conditions, chips, fields, containerRef, setMenuOffset
61
61
  setMenuState,
62
62
  upsertCondition
63
63
  ]);
64
- const resetSegmentState = useCallback(()=>{
64
+ const clearEditing = useCallback(()=>{
65
+ setEditingChipId(null);
65
66
  setEditingSegment(null);
66
67
  setSegmentFilterText('');
67
68
  setUserHasTyped(false);
68
69
  }, []);
69
- const clearEditing = useCallback(()=>{
70
- setEditingChipId(null);
71
- resetSegmentState();
72
- }, [
73
- resetSegmentState
74
- ]);
75
- const cancelSegmentEdit = useCallback(()=>{
76
- resetSegmentState();
77
- setMenuState('closed');
78
- }, [
79
- resetSegmentState,
80
- setMenuState
81
- ]);
82
70
  const handleSegmentFilterChange = useCallback((text)=>{
83
71
  setSegmentFilterText(text);
84
72
  setUserHasTyped(true);
@@ -97,8 +85,7 @@ const useChipEditing = ({ conditions, chips, fields, containerRef, setMenuOffset
97
85
  setSegmentFilterText: handleSegmentFilterChange,
98
86
  resetSegmentTyping,
99
87
  handleChipClick,
100
- clearEditing,
101
- cancelSegmentEdit
88
+ clearEditing
102
89
  }), [
103
90
  editingChipId,
104
91
  editingSegment,
@@ -107,8 +94,7 @@ const useChipEditing = ({ conditions, chips, fields, containerRef, setMenuOffset
107
94
  handleSegmentFilterChange,
108
95
  resetSegmentTyping,
109
96
  handleChipClick,
110
- clearEditing,
111
- cancelSegmentEdit
97
+ clearEditing
112
98
  ]);
113
99
  };
114
100
  export { useChipEditing };
@@ -159,6 +159,14 @@ const useFilterInputAutocomplete = ({ fields, conditions, chips, upsertCondition
159
159
  selectedField,
160
160
  editing
161
161
  ]);
162
+ const cancelSegmentEdit = useCallback(()=>{
163
+ setSelectedField(null);
164
+ setSelectedOperator(null);
165
+ editing.clearEditing();
166
+ setMenuState('closed');
167
+ }, [
168
+ editing
169
+ ]);
162
170
  return {
163
171
  inputText,
164
172
  menuState,
@@ -197,7 +205,7 @@ const useFilterInputAutocomplete = ({ fields, conditions, chips, upsertCondition
197
205
  segmentFilterText: editing.segmentFilterText,
198
206
  segmentMenuFilterText: editing.segmentMenuFilterText,
199
207
  handleSegmentFilterChange,
200
- cancelSegmentEdit: editing.cancelSegmentEdit,
208
+ cancelSegmentEdit,
201
209
  handleCustomValueCommit,
202
210
  handleCustomAttributeCommit,
203
211
  menuRef,
@@ -1,53 +1,17 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { useTestId } from "../../../utils/testId.js";
3
- import { Link } from "../../Link/index.js";
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
- const count = selectedIds.size;
11
- return /*#__PURE__*/ jsxs("div", {
8
+ return /*#__PURE__*/ jsx(BulkBarSummary, {
12
9
  "data-testid": testId,
13
- className: "flex flex-nowrap items-center gap-16 p-8 whitespace-nowrap",
14
- children: [
15
- /*#__PURE__*/ jsxs(Text, {
16
- size: "sm",
17
- color: "primary-alt",
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', 'bg-component-toast-bg rounded-16 shadow-lg', 'pl-12 pr-8 py-8', '[&_button]:shrink-0 [&_button]:whitespace-nowrap', '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'), {
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: 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'),
17
+ className: bulkBarSurfaceClasses,
18
18
  children: /*#__PURE__*/ jsxs(HStack, {
19
19
  gap: 40,
20
20
  align: "center",
@@ -1,58 +1,16 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { useTestId } from "../../../utils/testId.js";
3
- import { Link } from "../../Link/index.js";
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
- const count = Object.keys(table.getState().rowSelection).length;
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
- className: "flex items-center gap-16 p-8",
21
- children: [
22
- /*#__PURE__*/ jsxs(Text, {
23
- size: "sm",
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
- "version": "0.33.1",
3
- "generatedAt": "2026-05-07T12:07:41.515Z",
2
+ "version": "0.34.0",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",