@wallarm-org/design-system 1.17.0 → 1.18.1-rc-fix-toast-description-layout.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.
@@ -15,7 +15,7 @@ const toTanStackPinning = (p, pinnedLeft)=>({
15
15
  end: p?.right ?? []
16
16
  });
17
17
  const TableProvider = (props)=>{
18
- const { data, columns, isLoading = false, isLoadingPrevious = false, skeletonCount = TABLE_SKELETON_ROWS, children, getRowId, sorting: sortingProp, onSortingChange, manualSorting = false, rowSelection: rowSelectionProp, onRowSelectionChange, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, getSubRows, renderExpandedRow, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, defaultColumnVisibility, defaultColumnOrder, columnGroups, virtualized, estimateRowHeight, overscan = TABLE_VIRTUALIZATION_OVERSCAN, onEndReached, onEndReachedThreshold, onStartReached, onStartReachedThreshold, initialScrollToRowId, onRowReorder, onMasterCellClick, activeRowId: activeRowIdProp, onSettingsOpenChange } = props;
18
+ const { data, columns, isLoading = false, isLoadingPrevious = false, skeletonCount = TABLE_SKELETON_ROWS, children, getRowId, sorting: sortingProp, onSortingChange, manualSorting = false, rowSelection: rowSelectionProp, onRowSelectionChange, enableSelectAllRows = true, onSelectAllRows, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, getSubRows, renderExpandedRow, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, defaultColumnVisibility, defaultColumnOrder, columnGroups, virtualized, estimateRowHeight, overscan = TABLE_VIRTUALIZATION_OVERSCAN, onEndReached, onEndReachedThreshold, onStartReached, onStartReachedThreshold, initialScrollToRowId, onRowReorder, onMasterCellClick, activeRowId: activeRowIdProp, onSettingsOpenChange } = props;
19
19
  const masterCellActiveRowId = activeRowIdProp ?? null;
20
20
  const sortingEnabled = !!onSortingChange;
21
21
  const selectionEnabled = !!onRowSelectionChange;
@@ -213,6 +213,8 @@ const TableProvider = (props)=>{
213
213
  alwaysPinnedLeft,
214
214
  masterColumnId,
215
215
  lastSelectedRowIndexRef,
216
+ selectAllRowsEnabled: enableSelectAllRows,
217
+ onSelectAllRows,
216
218
  containerRef,
217
219
  tbodyRef,
218
220
  virtualizerRef,
@@ -259,7 +261,9 @@ const TableProvider = (props)=>{
259
261
  onRowReorder,
260
262
  masterCellActiveRowId,
261
263
  onMasterCellClick,
262
- onSettingsOpenChange
264
+ onSettingsOpenChange,
265
+ enableSelectAllRows,
266
+ onSelectAllRows
263
267
  ]);
264
268
  useEffect(()=>{
265
269
  if (!selectionEnabled) return;
@@ -34,6 +34,8 @@ export interface TableContextValue<T extends RowData> {
34
34
  columnGroups?: TableColumnGroup[];
35
35
  setColumnOrder: (order: string[]) => void;
36
36
  lastSelectedRowIndexRef: RefObject<number | null>;
37
+ selectAllRowsEnabled: boolean;
38
+ onSelectAllRows?: (selected: boolean) => void;
37
39
  alwaysPinnedLeft: string[];
38
40
  masterColumnId: string | null;
39
41
  containerRef: RefObject<HTMLDivElement | null>;
@@ -42,7 +42,7 @@ const SelectionCell = ({ row, table })=>{
42
42
  });
43
43
  };
44
44
  const SelectAllHeaderCell = (_props)=>{
45
- const { table } = useTableContext();
45
+ const { table, selectAllRowsEnabled, onSelectAllRows } = useTableContext();
46
46
  const checked = table.getIsAllRowsSelected();
47
47
  const { selectableCount, selectedCount } = table.getFilteredRowModel().flatRows.reduce((acc, row)=>{
48
48
  if (!row.getCanSelect()) return acc;
@@ -54,9 +54,14 @@ const SelectAllHeaderCell = (_props)=>{
54
54
  selectedCount: 0
55
55
  });
56
56
  const indeterminate = !checked && selectedCount > 0;
57
+ if (!selectAllRowsEnabled) return null;
58
+ const handleCheckedChange = ()=>{
59
+ table.toggleAllRowsSelected(!checked);
60
+ onSelectAllRows?.(!checked);
61
+ };
57
62
  return /*#__PURE__*/ jsx(Checkbox, {
58
63
  checked: indeterminate ? 'indeterminate' : checked,
59
- onCheckedChange: ()=>table.toggleAllRowsSelected(!checked),
64
+ onCheckedChange: handleCheckedChange,
60
65
  disabled: 0 === selectableCount,
61
66
  children: /*#__PURE__*/ jsx(CheckboxIndicator, {})
62
67
  });
@@ -190,6 +190,28 @@ export interface TableProps<T> extends TestableProps {
190
190
  manualSorting?: boolean;
191
191
  rowSelection?: TableRowSelectionState;
192
192
  onRowSelectionChange?: TableOnChangeFn<TableRowSelectionState>;
193
+ /**
194
+ * Renders the master checkbox in the selection column header.
195
+ *
196
+ * Set `false` when "all rows" is not a selection the consumer can act on —
197
+ * a listing whose scope the consumer cannot express, for instance — leaving
198
+ * per-row checkboxes (shift-click range selection included) as the only way
199
+ * to select. The column itself stays, so the layout does not shift.
200
+ *
201
+ * Default: `true`.
202
+ */
203
+ enableSelectAllRows?: boolean;
204
+ /**
205
+ * Called when the master checkbox is toggled, with its new state, in
206
+ * addition to the `onRowSelectionChange` the toggle produces.
207
+ *
208
+ * The state change alone cannot identify the gesture: "every loaded row is
209
+ * selected" is also what checking the last row by hand produces. A consumer
210
+ * that treats the master checkbox as meaning more than the loaded rows —
211
+ * everything matching a server-side filter, say — needs to know the
212
+ * difference, which is what this reports.
213
+ */
214
+ onSelectAllRows?: (selected: boolean) => void;
193
215
  columnSizing?: TableColumnSizingState;
194
216
  onColumnSizingChange?: TableOnChangeFn<TableColumnSizingState>;
195
217
  columnPinning?: TableColumnPinningState;
@@ -14,6 +14,19 @@ export interface ToastData {
14
14
  export interface ToastProps {
15
15
  toast: ToastData;
16
16
  }
17
+ /**
18
+ * Which layout a toast ends up in.
19
+ *
20
+ * `simple` is a single row and renders the title ALONE, so a `description`
21
+ * handed to it would be dropped without a trace — and the description is
22
+ * usually the actionable half (an error's reason, what happens next). Losing
23
+ * the caller's text is never the better reading of the pair, so a description
24
+ * decides the layout whenever there is one; `variant` decides it otherwise.
25
+ *
26
+ * Shared with the toaster, which sizes the auto-dismiss timer off the same
27
+ * answer: text nobody has time to read is the other way to lose it.
28
+ */
29
+ export declare const resolveToastVariant: (variant: unknown, description: unknown) => NonNullable<ToastData['variant']>;
17
30
  export declare function Toast({ toast }: ToastProps): import("react").JSX.Element;
18
31
  export declare namespace Toast {
19
32
  var displayName: string;
@@ -19,7 +19,7 @@ const toastVariants = cva('group relative flex min-w-[256px] max-w-[560px] items
19
19
  }
20
20
  },
21
21
  defaultVariants: {
22
- variant: 'extended'
22
+ variant: 'simple'
23
23
  }
24
24
  });
25
25
  const toastIconMap = {
@@ -42,8 +42,9 @@ const toastIconMap = {
42
42
  };
43
43
  const SIMPLE_TOAST_DURATION_MS = 5000;
44
44
  const EXTENDED_TOAST_DURATION_MS = 10000;
45
+ const resolveToastVariant = (variant, description)=>description || 'extended' === variant ? 'extended' : 'simple';
45
46
  const Toast_Toast = ({ toast })=>{
46
- const toastVariant = toast.variant || 'simple';
47
+ const toastVariant = resolveToastVariant(toast.variant, toast.description);
47
48
  const isSimple = 'simple' === toastVariant;
48
49
  const closable = false !== toast.closable;
49
50
  const getToastIcon = ()=>{
@@ -122,4 +123,4 @@ const Toast_Toast = ({ toast })=>{
122
123
  }, toast.id);
123
124
  };
124
125
  Toast_Toast.displayName = 'Toast';
125
- export { Toast_Toast as Toast };
126
+ export { Toast_Toast as Toast, resolveToastVariant };
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Portal } from "@ark-ui/react/portal";
3
3
  import { Toaster, createToaster } from "@ark-ui/react/toast";
4
4
  import { cn } from "../../utils/cn.js";
5
- import { Toast } from "./Toast.js";
5
+ import { Toast, resolveToastVariant } from "./Toast.js";
6
6
  const SIMPLE_TOAST_DURATION_MS = 5000;
7
7
  const EXTENDED_TOAST_DURATION_MS = 10000;
8
8
  const DEFAULT_TOAST_PRIORITY = {
@@ -18,7 +18,7 @@ const toaster = {
18
18
  __arkToaster: arkToaster,
19
19
  create: (options)=>arkToaster.create({
20
20
  ...options,
21
- duration: options.duration ?? ('extended' === options.variant ? EXTENDED_TOAST_DURATION_MS : SIMPLE_TOAST_DURATION_MS),
21
+ duration: options.duration ?? ('extended' === resolveToastVariant(options.variant, options.description) ? EXTENDED_TOAST_DURATION_MS : SIMPLE_TOAST_DURATION_MS),
22
22
  priority: options.priority ?? ('default' === options.type ? options.actions ? DEFAULT_TOAST_PRIORITY.actionable : DEFAULT_TOAST_PRIORITY.nonActionable : void 0)
23
23
  }),
24
24
  update: (id, options)=>{
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.16.0",
3
- "generatedAt": "2026-09-07T14:31:27.423Z",
2
+ "version": "1.18.0",
3
+ "generatedAt": "2026-09-08T12:47:00.336Z",
4
4
  "components": [
5
5
  {
6
6
  "name": "Accordion",
@@ -79002,6 +79002,12 @@
79002
79002
  "type": "TableRowSelectionState | undefined",
79003
79003
  "required": false
79004
79004
  },
79005
+ {
79006
+ "name": "enableSelectAllRows",
79007
+ "type": "boolean | undefined",
79008
+ "required": false,
79009
+ "description": "Renders the master checkbox in the selection column header.\n\nSet `false` when \"all rows\" is not a selection the consumer can act on —\na listing whose scope the consumer cannot express, for instance — leaving\nper-row checkboxes (shift-click range selection included) as the only way\nto select. The column itself stays, so the layout does not shift.\n\nDefault: `true`."
79010
+ },
79005
79011
  {
79006
79012
  "name": "columnSizing",
79007
79013
  "type": "TableColumnSizingState | undefined",
@@ -85141,6 +85147,16 @@
85141
85147
  "code": "() => {\n const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});\n\n return (\n <Table\n data={securityEvents}\n columns={securityColumns}\n getRowId={row => row.id}\n rowSelection={rowSelection}\n onRowSelectionChange={setRowSelection}\n >\n <TableActionBar>\n <Button variant='ghost' color='neutral-alt' onClick={onDuplicate}>\n <Copy /> Duplicate\n </Button>\n <Button color='brand' onClick={onDelete}>\n <Trash2 /> Delete\n </Button>\n </TableActionBar>\n </Table>\n );\n}",
85142
85148
  "description": "Checkboxes plus `TableActionBar`, which rises from the bottom once a row is ticked and\ncarries the verbs that apply to the whole selection."
85143
85149
  },
85150
+ {
85151
+ "name": "SelectAllRowsGesture",
85152
+ "code": "() => {\n const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});\n const [filterWide, setFilterWide] = useState(false);\n const MATCHING_THE_FILTER = 1474;\n\n const selectedCount = filterWide ? MATCHING_THE_FILTER : Object.keys(rowSelection).length;\n\n return (\n <Table\n data={securityEvents}\n columns={securityColumns}\n getRowId={row => row.id}\n rowSelection={rowSelection}\n onRowSelectionChange={updater => {\n setRowSelection(updater);\n // \"Everything matching the filter, minus this one row\" is not a filter,\n // so any hand-made change falls back to the explicit list.\n setFilterWide(false);\n }}\n onSelectAllRows={setFilterWide}\n >\n <TableActionBar>\n <TableActionBarSelection>\n <BulkBarSummaryCount>\n {selectedCount} {selectedCount === 1 ? 'event' : 'events'} selected\n </BulkBarSummaryCount>\n <BulkBarSummaryClear />\n </TableActionBarSelection>\n <Button color='brand' onClick={onDelete}>\n <Trash2 /> Delete\n </Button>\n </TableActionBar>\n </Table>\n );\n}",
85153
+ "description": "`onSelectAllRows` separates the master checkbox from a hand-made full selection, which the\nrow state alone cannot tell apart. Here the gesture means \"every row matching the filter\",\nincluding the ones the server has not sent — so the bar jumps to the filter's total, and any\nmanual change drops back to the rows actually loaded."
85154
+ },
85155
+ {
85156
+ "name": "SelectAllRowsDisabled",
85157
+ "code": "() => {\n const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});\n\n return (\n <Table\n data={securityEvents}\n columns={securityColumns}\n getRowId={row => row.id}\n rowSelection={rowSelection}\n onRowSelectionChange={setRowSelection}\n enableSelectAllRows={false}\n />\n );\n}",
85158
+ "description": "`enableSelectAllRows={false}` drops the master checkbox while keeping the column, for a\nlisting where \"all rows\" is not a scope the consumer can act on. Per-row checkboxes stay,\nshift-click range selection included."
85159
+ },
85144
85160
  {
85145
85161
  "name": "RowSelectionWindowScroll",
85146
85162
  "code": "() => {\n const largeData = useMemo(() => createLargeSecurityEvents(100), []);\n const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});\n\n return (\n <>\n <Table\n data-testid='row-selection-window-scroll-table'\n data={largeData}\n columns={securityColumns}\n getRowId={row => row.id}\n virtualized='window'\n rowSelection={rowSelection}\n onRowSelectionChange={setRowSelection}\n >\n <TableActionBar>\n <Button variant='ghost' color='neutral-alt' onClick={onDuplicate}>\n <Copy /> Duplicate\n </Button>\n <Button color='brand' onClick={onDelete}>\n <Trash2 /> Delete\n </Button>\n </TableActionBar>\n </Table>\n {/* Filler so the e2e suite can scroll the table fully out of view while a\n selection stays active — this story's only content otherwise fills\n exactly to the table's own height, so max scroll would always leave\n the table's tail in view. Generous margin over the viewport height\n (800px in the e2e config) so the anchor is unambiguously out of view\n at max scroll, not just mostly. */}\n <div style={{ height: 3000 }} />\n </>\n );\n}",
@@ -89930,6 +89946,7 @@
89930
89946
  },
89931
89947
  {
89932
89948
  "name": "Toast",
89949
+ "description": "Which layout a toast ends up in.\n\n`simple` is a single row and renders the title ALONE, so a `description`\nhanded to it would be dropped without a trace — and the description is\nusually the actionable half (an error's reason, what happens next). Losing\nthe caller's text is never the better reading of the pair, so a description\ndecides the layout whenever there is one; `variant` decides it otherwise.\n\nShared with the toaster, which sizes the auto-dismiss timer off the same\nanswer: text nobody has time to read is the other way to lose it.",
89933
89950
  "importPath": "@wallarm-org/design-system/Toast",
89934
89951
  "props": [],
89935
89952
  "variants": [
@@ -89939,7 +89956,7 @@
89939
89956
  "extended",
89940
89957
  "simple"
89941
89958
  ],
89942
- "defaultValue": "extended"
89959
+ "defaultValue": "simple"
89943
89960
  }
89944
89961
  ],
89945
89962
  "subComponents": [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "1.17.0",
3
+ "version": "1.18.1-rc-fix-toast-description-layout.1",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",