prime-ui-kit 0.19.0 → 0.20.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.
Files changed (85) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{chunk-RZNGLELR.js → chunk-3PY52JP3.js} +1603 -1609
  3. package/dist/chunks/{chunk-WYCTXD63.js → chunk-4374EBWV.js} +3593 -2889
  4. package/dist/chunks/{chunk-ZTZ2ML2B.js → chunk-4KONMO7Z.js} +1 -1
  5. package/dist/color-picker.js +2 -2
  6. package/dist/components/data-table/ColumnsMenu.d.ts +34 -8
  7. package/dist/components/data-table/DataTable.d.ts +31 -5
  8. package/dist/components/data-table/DataTableColumnsMenu.d.ts +45 -0
  9. package/dist/components/data-table/Head.d.ts +14 -8
  10. package/dist/components/data-table/Row.d.ts +8 -8
  11. package/dist/components/data-table/StateRows.d.ts +5 -5
  12. package/dist/components/data-table/columnOrder.d.ts +14 -0
  13. package/dist/components/data-table/reorder.d.ts +15 -5
  14. package/dist/components/data-table/types.d.ts +5 -0
  15. package/dist/components/data-table/useFrozenColumns.d.ts +6 -2
  16. package/dist/components/datepicker/DatepickerPanel.d.ts +1 -1
  17. package/dist/components/dnd/Dnd.d.ts +9 -5
  18. package/dist/components/dnd/inPlaceRow.d.ts +7 -0
  19. package/dist/components/dnd/useDragSource.d.ts +2 -0
  20. package/dist/components/dnd/useSortableList.d.ts +5 -0
  21. package/dist/components/field-list/FieldList.d.ts +34 -12
  22. package/dist/components/gantt/Gantt.d.ts +1 -1
  23. package/dist/components/index.d.ts +2 -0
  24. package/dist/components/scroll-container/ScrollContainer.d.ts +1 -1
  25. package/dist/index.css +1 -1
  26. package/dist/index.js +4 -2
  27. package/dist/internal/ToolRow.d.ts +23 -0
  28. package/dist/internal/fieldCell.d.ts +0 -6
  29. package/dist/layout/page/Page.d.ts +7 -7
  30. package/dist/skill/anti-slop.md +43 -12
  31. package/dist/skill/api-contract.md +1 -1
  32. package/dist/skill/cheatsheet.md +7 -3
  33. package/dist/skill/checklist.md +4 -1
  34. package/dist/skill/choosing.md +1 -0
  35. package/dist/skill/components.md +1 -1
  36. package/dist/skill/composition.md +137 -20
  37. package/dist/skill/reference/components/data-table/COMPONENT.md +101 -40
  38. package/dist/skill/reference/components/data-table/examples/column-order.tsx +152 -0
  39. package/dist/skill/reference/components/data-table/examples/columns-visibility.tsx +20 -11
  40. package/dist/skill/reference/components/data-table/examples/controlled.tsx +32 -17
  41. package/dist/skill/reference/components/data-table/examples/examples.module.css +14 -36
  42. package/dist/skill/reference/components/data-table/examples/narrow.tsx +24 -11
  43. package/dist/skill/reference/components/data-table/examples/reorder.tsx +24 -2
  44. package/dist/skill/reference/components/data-table/examples/selection.tsx +13 -18
  45. package/dist/skill/reference/components/data-table/examples/server.tsx +45 -31
  46. package/dist/skill/reference/components/data-table/examples/toolbar.tsx +5 -12
  47. package/dist/skill/reference/components/datepicker/COMPONENT.md +2 -2
  48. package/dist/skill/reference/components/dnd/COMPONENT.md +12 -7
  49. package/dist/skill/reference/components/dnd/examples/table-columns.tsx +75 -0
  50. package/dist/skill/reference/components/field-list/COMPONENT.md +70 -43
  51. package/dist/skill/reference/components/field-list/examples/narrow.tsx +108 -33
  52. package/dist/skill/reference/components/field-list/examples/reorder.tsx +1 -1
  53. package/dist/skill/reference/components/field-list/examples/row-menu.tsx +71 -0
  54. package/dist/skill/reference/components/field-list/examples/screen.tsx +2 -1
  55. package/dist/skill/reference/components/field-list/examples/variants.tsx +51 -0
  56. package/dist/skill/reference/components/gantt/COMPONENT.md +4 -4
  57. package/dist/skill/reference/components/scroll-container/COMPONENT.md +1 -1
  58. package/dist/skill/reference/components/smart-filter/COMPONENT.md +2 -2
  59. package/dist/skill/reference/layout/page/COMPONENT.md +8 -5
  60. package/dist/skill/responsive.md +10 -8
  61. package/dist/tokens/semantic.d.ts +1 -1
  62. package/package.json +1 -1
  63. package/src/components/data-table/COMPONENT.md +101 -40
  64. package/src/components/data-table/examples/column-order.tsx +152 -0
  65. package/src/components/data-table/examples/columns-visibility.tsx +20 -11
  66. package/src/components/data-table/examples/controlled.tsx +32 -17
  67. package/src/components/data-table/examples/examples.module.css +14 -36
  68. package/src/components/data-table/examples/narrow.tsx +24 -11
  69. package/src/components/data-table/examples/reorder.tsx +24 -2
  70. package/src/components/data-table/examples/selection.tsx +13 -18
  71. package/src/components/data-table/examples/server.tsx +45 -31
  72. package/src/components/data-table/examples/toolbar.tsx +5 -12
  73. package/src/components/datepicker/COMPONENT.md +2 -2
  74. package/src/components/dnd/COMPONENT.md +12 -7
  75. package/src/components/dnd/examples/table-columns.tsx +75 -0
  76. package/src/components/field-list/COMPONENT.md +70 -43
  77. package/src/components/field-list/examples/narrow.tsx +108 -33
  78. package/src/components/field-list/examples/reorder.tsx +1 -1
  79. package/src/components/field-list/examples/row-menu.tsx +71 -0
  80. package/src/components/field-list/examples/screen.tsx +2 -1
  81. package/src/components/field-list/examples/variants.tsx +51 -0
  82. package/src/components/gantt/COMPONENT.md +4 -4
  83. package/src/components/scroll-container/COMPONENT.md +1 -1
  84. package/src/components/smart-filter/COMPONENT.md +2 -2
  85. package/src/layout/page/COMPONENT.md +8 -5
@@ -23,7 +23,7 @@ import {
23
23
  useInheritedDisabled,
24
24
  useLabels,
25
25
  useOpenState
26
- } from "./chunk-RZNGLELR.js";
26
+ } from "./chunk-3PY52JP3.js";
27
27
  import {
28
28
  cx,
29
29
  useHostTier
@@ -4,8 +4,8 @@ import {
4
4
  ColorField,
5
5
  ColorPicker,
6
6
  parseColor
7
- } from "./chunks/chunk-ZTZ2ML2B.js";
8
- import "./chunks/chunk-RZNGLELR.js";
7
+ } from "./chunks/chunk-4KONMO7Z.js";
8
+ import "./chunks/chunk-3PY52JP3.js";
9
9
  import "./chunks/chunk-QFHE5GKW.js";
10
10
  export {
11
11
  ColorField,
@@ -1,19 +1,45 @@
1
- import { type ControlSize } from "../../internal/states";
1
+ import * as React from "react";
2
+ import type { ControlSize } from "../../internal/states";
2
3
  import type { DataTableLabels } from "./DataTable";
3
4
  import type { DataTableColumn } from "./types";
5
+ type Column = DataTableColumn<never>;
6
+ /** The strings of the column chooser, in the table's `labels` and in `DataTableColumnsMenu`. */
7
+ export type DataTableColumnsMenuLabels = Pick<DataTableLabels, "columns" | "showColumns" | "showAllColumns" | "resetColumnOrder" | "reorderColumn">;
8
+ /** The chooser reorders columns too (`columnOrder`). */
9
+ export type ColumnsMenuReorder = {
10
+ /** Columns that hold their place: a lock instead of the grip. */
11
+ locked: ReadonlySet<string>;
12
+ onReorder: (id: string, beforeId: string | null) => void;
13
+ /** Back to the order of `columns`; null while that is the order. */
14
+ reset: (() => void) | null;
15
+ };
4
16
  type ColumnsMenuProps = {
5
17
  /** Every column, hidden ones included, in table order. */
6
- columns: DataTableColumn<never>[];
18
+ columns: Column[];
7
19
  hidden: ReadonlySet<string>;
8
20
  setHidden: (hidden: string[]) => void;
9
- labels: DataTableLabels;
21
+ reorder: ColumnsMenuReorder | null;
22
+ labels: DataTableColumnsMenuLabels;
23
+ /** The tier of the trigger and the menu. */
10
24
  size: ControlSize;
25
+ /**
26
+ * `icon`: the icon-only ghost trigger in the head of the row-actions column (`columnsMenu`);
27
+ * `button`: the labelled soft trigger with the count of shown columns, for the page's tools.
28
+ */
29
+ trigger: "icon" | "button";
30
+ /** The labelled trigger's own attributes, class and ref (`DataTableColumnsMenu`). */
31
+ triggerProps?: React.ButtonHTMLAttributes<HTMLButtonElement> & {
32
+ ref?: React.Ref<HTMLButtonElement>;
33
+ };
11
34
  };
35
+ /** Columns that hold their place in the chooser: `reorderable: false` and the row actions. */
36
+ export declare function lockedInChooser(columns: readonly Column[]): Set<string>;
12
37
  /**
13
- * The column chooser of the table (`columnsMenu`), drawn in its header row: an icon-only ghost
14
- * Button one tier below the table, named and tipped by `labels.columns`, opening a Dropdown with a
15
- * check item per column and «Показать все». A column with `hideable: false` stays checked and
16
- * disabled, and the last visible column cannot be hidden.
38
+ * The column chooser: a trigger (`trigger`) opening a Dropdown with a «Показывать» group of check
39
+ * items, one per column, and «Показать все». A column with `hideable: false` stays checked and
40
+ * disabled, and the last visible column cannot be hidden. With `reorder` the items are a
41
+ * Dnd.Sortable list: a grip ends each item (a lock on a column that holds its place), Alt + ↑ / ↓ on
42
+ * the focused item moves it, and «Исходный порядок» puts the order of `columns` back.
17
43
  */
18
- export declare function ColumnsMenu({ columns, hidden, setHidden, labels, size }: ColumnsMenuProps): import("react/jsx-runtime").JSX.Element;
44
+ export declare function ColumnsMenu({ columns, hidden, setHidden, reorder, labels, size, trigger, triggerProps, }: ColumnsMenuProps): import("react/jsx-runtime").JSX.Element;
19
45
  export {};
@@ -26,8 +26,14 @@ export type DataTableLabels = {
26
26
  collapse: string;
27
27
  /** Name and tooltip of the column chooser (`columnsMenu`); `{shown}` and `{total}` are counts. */
28
28
  columns: string;
29
+ /** The heading of the column chooser's list of columns. */
30
+ showColumns: string;
29
31
  /** The column chooser item that shows every column again. */
30
32
  showAllColumns: string;
33
+ /** The column chooser item that puts the order of `columns` back (`columnOrder`). */
34
+ resetColumnOrder: string;
35
+ /** `aria-label` of a column's grip in the column chooser (`columnOrder`); `{label}` is its header. */
36
+ reorderColumn: string;
31
37
  /** `aria-label` of a row's drag handle (`onReorder`); `{label}` is `getRowLabel(row)`. */
32
38
  reorderRow: string;
33
39
  /** Tooltip of the handles while the table is sorted by a column (reordering is off). */
@@ -48,7 +54,7 @@ export type DataTableProps<Row> = Omit<React.HTMLAttributes<HTMLDivElement>, "ch
48
54
  */
49
55
  columns: DataTableColumn<Row>[];
50
56
  /**
51
- * Ids of columns that are not rendered, controlled. A column with `hideable: false` stays. The column chooser (`columnsMenu`) changes it.
57
+ * Ids of columns that are not rendered, controlled. A column with `hideable: false` stays. The column chooser (`columnsMenu`, `DataTableColumnsMenu`) changes it.
52
58
  */
53
59
  hiddenColumns?: string[];
54
60
  /**
@@ -60,7 +66,19 @@ export type DataTableProps<Row> = Omit<React.HTMLAttributes<HTMLDivElement>, "ch
60
66
  */
61
67
  onHiddenColumnsChange?: (hiddenColumns: string[]) => void;
62
68
  /**
63
- * The column chooser at the end of the header row: in the head cell of a trailing row-actions column (`hideHeader`), else in a cell of its own; sticks with `stickyLastColumn`. Needs `showHeader`.
69
+ * Column ids in screen order, hidden ones keeping their place, controlled. Any prop of this triad makes columns reorder: a header drag (the body stays until the drop), Alt + ← / → on a header, grips in the column chooser.
70
+ */
71
+ columnOrder?: string[];
72
+ /**
73
+ * Initial column order, uncontrolled; `[]` — the order of `columns`, reorderable.
74
+ */
75
+ defaultColumnOrder?: string[];
76
+ /**
77
+ * The order changed: a header dropped, a keyboard move, a chooser grip or «Исходный порядок». The kit stores nothing: keep it with `hiddenColumns` and pass it back.
78
+ */
79
+ onColumnOrderChange?: (columnOrder: string[]) => void;
80
+ /**
81
+ * The column chooser in the head of the row-actions column (the last one, `hideHeader`); reorders with `columnOrder`. Without that column it renders nothing and warns: use `DataTableColumnsMenu` in the page's tools.
64
82
  */
65
83
  columnsMenu?: boolean;
66
84
  /**
@@ -224,9 +242,13 @@ export type DataTableProps<Row> = Omit<React.HTMLAttributes<HTMLDivElement>, "ch
224
242
  */
225
243
  onSelectedChange?: (selected: React.Key[]) => void;
226
244
  /**
227
- * Rows reorder by a leading handle column. Row `id` goes in front of `beforeId` (`null` = last); apply it with `moveBefore`, return a promise to save. Off while sorted by a column.
245
+ * Rows reorder (by a grip, see `reorderHandle`). Row `id` goes in front of `beforeId` (`null` = last); apply it with `moveBefore`, return a promise to save. Off while sorted by a column.
228
246
  */
229
247
  onReorder?: (id: React.Key, beforeId: React.Key | null) => void | Promise<void>;
248
+ /**
249
+ * Where a row is picked up (`onReorder`): `end` — a grip ends the row; `start` — a grip column leads it; `row` — no grip, the whole row is carried and takes Alt + ↑ / ↓ itself.
250
+ */
251
+ reorderHandle?: "start" | "end" | "row";
230
252
  /**
231
253
  * Sub-rows rendered under the parent with the same columns, indented by depth.
232
254
  */
@@ -260,9 +282,13 @@ export type DataTableProps<Row> = Omit<React.HTMLAttributes<HTMLDivElement>, "ch
260
282
  */
261
283
  loadingRows?: number;
262
284
  /**
263
- * Panel above the table for several controls of the table itself (bulk actions on the selected rows, a table-local search with filters); stacks below 30rem of table width.
285
+ * The table's own tools row — search, filter, `DataTableColumnsMenu`, a view, bulk actions; two or more, unwrapped. Laid out as `Page.Tools`: the search takes the free room, the rest keep their width at the end.
264
286
  */
265
287
  toolbar?: React.ReactNode;
288
+ /**
289
+ * The applied filters (`SmartFilter.Chips`) on a line under the `toolbar`, gone while empty; `SmartFilter.Root` wraps the DataTable.
290
+ */
291
+ toolbarChips?: React.ReactNode;
266
292
  /**
267
293
  * Group key of a row: each group gets a header row and its own `<tbody>`. Groups keep the order in which they first appear in `rows`; a sort orders the rows inside each group; a group split by paging repeats its header.
268
294
  */
@@ -288,4 +314,4 @@ export type DataTableProps<Row> = Omit<React.HTMLAttributes<HTMLDivElement>, "ch
288
314
  */
289
315
  onCollapsedGroupsChange?: (collapsedGroups: (string | number)[]) => void;
290
316
  };
291
- export declare function DataTable<Row>({ columns: allColumns, hiddenColumns, defaultHiddenColumns, onHiddenColumnsChange, columnsMenu, rows, source, rowCount, size: sizeProp, className, showHeader, stickyHeader, stickyFirstColumn, stickyLastColumn, getRowKey, getRowHref, onRowClick, isRowClickable, loading, empty, labels: labelsProp, rowDividers, columnDividers, sort, defaultSort, onSortChange, paging, page, defaultPage, onPageChange, pageSize, infiniteBatchSize, hasMore, loadingMore, onLoadMore, scrollHeight, fullWidth, highlightRowOnHover, highlightColumnOnHover, striped, getRowLabel, selectable, selected, defaultSelected, onSelectedChange, onReorder, getRowChildren, renderExpanded, isRowExpandable, expanded, defaultExpanded, onExpandedChange, loadError, loadingRows, toolbar, getRowGroup, renderGroupHeader, stickyGroupHeaders, collapsedGroups, defaultCollapsedGroups, onCollapsedGroupsChange, ref, ...rest }: DataTableProps<Row>): import("react/jsx-runtime").JSX.Element;
317
+ export declare function DataTable<Row>({ columns: allColumns, hiddenColumns, defaultHiddenColumns, onHiddenColumnsChange, columnOrder, defaultColumnOrder, onColumnOrderChange, columnsMenu, rows, source, rowCount, size: sizeProp, className, showHeader, stickyHeader, stickyFirstColumn, stickyLastColumn, getRowKey, getRowHref, onRowClick, isRowClickable, loading, empty, labels: labelsProp, rowDividers, columnDividers, sort, defaultSort, onSortChange, paging, page, defaultPage, onPageChange, pageSize, infiniteBatchSize, hasMore, loadingMore, onLoadMore, scrollHeight, fullWidth, highlightRowOnHover, highlightColumnOnHover, striped, getRowLabel, selectable, selected, defaultSelected, onSelectedChange, onReorder, reorderHandle, getRowChildren, renderExpanded, isRowExpandable, expanded, defaultExpanded, onExpandedChange, loadError, loadingRows, toolbar, toolbarChips, getRowGroup, renderGroupHeader, stickyGroupHeaders, collapsedGroups, defaultCollapsedGroups, onCollapsedGroupsChange, ref, ...rest }: DataTableProps<Row>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import * as React from "react";
2
+ import type { ControlSize } from "../../internal/states";
3
+ import { type DataTableColumnsMenuLabels } from "./ColumnsMenu";
4
+ import type { DataTableColumn } from "./types";
5
+ export type { DataTableColumnsMenuLabels } from "./ColumnsMenu";
6
+ export type DataTableColumnsMenuProps<Row> = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "type"> & {
7
+ /**
8
+ * The table's `columns`, in the order of the code.
9
+ */
10
+ columns: DataTableColumn<Row>[];
11
+ /**
12
+ * The ids the table hides: the same list its `hiddenColumns` reads.
13
+ */
14
+ hiddenColumns: string[];
15
+ /**
16
+ * A column was shown or hidden, or «Показать все».
17
+ */
18
+ onHiddenColumnsChange: (hiddenColumns: string[]) => void;
19
+ /**
20
+ * The table's `columnOrder`.
21
+ */
22
+ columnOrder?: string[];
23
+ /**
24
+ * Turns the items into a sortable list (a grip, Alt + ↑ / ↓) with «Исходный порядок»; the new order of every column.
25
+ */
26
+ onColumnOrderChange?: (columnOrder: string[]) => void;
27
+ /**
28
+ * Tier of the trigger and the menu.
29
+ */
30
+ size?: ControlSize;
31
+ /**
32
+ * The chooser's strings: `columns`, `showColumns`, `showAllColumns`, `resetColumnOrder`, `reorderColumn`.
33
+ */
34
+ labels?: Partial<DataTableColumnsMenuLabels>;
35
+ ref?: React.Ref<HTMLButtonElement>;
36
+ };
37
+ /**
38
+ * The column chooser of a DataTable that has no row-actions column to hold it: a labelled soft
39
+ * Button with the count of shown columns, for the page's tools, bound to the same state the table
40
+ * reads (`hiddenColumns`, and `columnOrder` when the columns reorder).
41
+ */
42
+ export declare function DataTableColumnsMenu<Row>({ columns, hiddenColumns, onHiddenColumnsChange, columnOrder, onColumnOrderChange, size: sizeProp, labels: labelsProp, ...triggerProps }: DataTableColumnsMenuProps<Row>): import("react/jsx-runtime").JSX.Element;
43
+ export declare namespace DataTableColumnsMenu {
44
+ var displayName: string;
45
+ }
@@ -1,6 +1,12 @@
1
1
  import * as React from "react";
2
2
  import type { ControlSize } from "../../internal/states";
3
3
  import type { DataTableColumn, DataTableSortState } from "./types";
4
+ /** Columns that reorder by their headers (`columnOrder`): the head row is a `Dnd.Sortable`. */
5
+ export type HeadColumnReorder = {
6
+ /** Columns that hold their place: their headers carry nothing, no column moves past them. */
7
+ locked: ReadonlySet<string>;
8
+ onReorder: (id: string, beforeId: string | null) => void;
9
+ };
4
10
  type HeadProps<Row> = {
5
11
  columns: DataTableColumn<Row>[];
6
12
  size: ControlSize;
@@ -11,17 +17,17 @@ type HeadProps<Row> = {
11
17
  stickyLastColumn: boolean;
12
18
  /** The head sticks to the top of the scroller. */
13
19
  stickyHeader: boolean;
14
- /** Sticky head and first column: the leading head cells stick to both edges. */
15
- stickyCorner: boolean;
16
20
  expandEnabled: boolean;
17
21
  /** Name of the info glyph of a column with a `description`. */
18
22
  infoLabel: string;
19
- /** A leading column of row handles (`onReorder`). */
20
- reorderable?: boolean;
21
- /** The column chooser trigger (`columnsMenu`), or null. */
23
+ /** A leading column of row grips (`reorderHandle="start"`). */
24
+ gripStart: boolean;
25
+ /** The column chooser trigger (`columnsMenu`) for the row-actions head cell, or null. */
22
26
  columnsMenu: React.ReactNode;
23
- /** The chooser stands in a cell of its own at the end; else in the row-actions head cell. */
24
- menuCell: boolean;
27
+ /** A trailing utility cell ends the row: the head of the end grips' column. */
28
+ endCell: boolean;
29
+ /** Header grips (`columnOrder`); null when columns keep their order. */
30
+ reorder: HeadColumnReorder | null;
25
31
  selectAll?: {
26
32
  checked: boolean;
27
33
  indeterminate: boolean;
@@ -30,5 +36,5 @@ type HeadProps<Row> = {
30
36
  onToggle: () => void;
31
37
  };
32
38
  };
33
- export declare function Head<Row>({ columns, size, sort, onSort, stickyFirstColumn, stickyLastColumn, stickyHeader, stickyCorner, expandEnabled, infoLabel, reorderable, columnsMenu, menuCell, selectAll, }: HeadProps<Row>): import("react/jsx-runtime").JSX.Element;
39
+ export declare function Head<Row>({ columns, size, sort, onSort, stickyFirstColumn, stickyLastColumn, stickyHeader, expandEnabled, infoLabel, gripStart, columnsMenu, endCell, reorder, selectAll, }: HeadProps<Row>): import("react/jsx-runtime").JSX.Element;
34
40
  export {};
@@ -17,8 +17,8 @@ export type RowShared<Row> = {
17
17
  stickyFirstColumn: boolean;
18
18
  /** The last visible column sticks to the end edge (row actions). */
19
19
  stickyLastColumn: boolean;
20
- /** A trailing cell under the head's column chooser (`columnsMenu` with no row-actions column). */
21
- menuCell: boolean;
20
+ /** A trailing utility cell ends every row: the row grip (`reorderHandle="end"`). */
21
+ endCell: boolean;
22
22
  striped: boolean;
23
23
  totalColumns: number;
24
24
  /**
@@ -33,7 +33,7 @@ export type RowShared<Row> = {
33
33
  scaleDomains: Map<string, [number, number]>;
34
34
  selection: RowSelectionHandlers;
35
35
  toggleExpanded: (key: React.Key) => void;
36
- /** Row reordering (`onReorder`): a handle column and sortable rows; null without it. */
36
+ /** Row reordering (`onReorder`): sortable rows with a grip cell or a row grip; null without it. */
37
37
  reorder: RowReorderShared | null;
38
38
  };
39
39
  type DataTableRowProps<Row> = {
@@ -95,14 +95,14 @@ type MeasureBodyProps<Row> = {
95
95
  columns: DataTableColumn<Row>[];
96
96
  selectable: boolean;
97
97
  expandEnabled: boolean;
98
- /** A leading column of row handles (`onReorder`). */
99
- reorderable: boolean;
100
- /** A trailing cell under the head's column chooser. */
101
- menuCell: boolean;
98
+ /** A leading column of row grips (`reorderHandle="start"`). */
99
+ gripStart: boolean;
100
+ /** A trailing utility cell (the end grip, the column chooser). */
101
+ endCell: boolean;
102
102
  };
103
103
  /**
104
104
  * Sub-rows of collapsed rows and rows of collapsed groups, laid out invisibly so the columns are
105
105
  * already as wide as they will be once a row or group opens; never shown or reachable.
106
106
  */
107
- export declare function MeasureBody<Row>({ rows, columns, selectable, expandEnabled, reorderable, menuCell, }: MeasureBodyProps<Row>): import("react/jsx-runtime").JSX.Element;
107
+ export declare function MeasureBody<Row>({ rows, columns, selectable, expandEnabled, gripStart, endCell, }: MeasureBodyProps<Row>): import("react/jsx-runtime").JSX.Element;
108
108
  export {};
@@ -8,10 +8,10 @@ type StateRowsProps<Row> = {
8
8
  totalColumns: number;
9
9
  selectable: boolean;
10
10
  expandEnabled: boolean;
11
- /** A leading column of row handles (`onReorder`). */
12
- reorderable?: boolean;
13
- /** A trailing cell under the head's column chooser. */
14
- menuCell: boolean;
11
+ /** A leading column of row grips (`reorderHandle="start"`). */
12
+ gripStart: boolean;
13
+ /** A trailing utility cell (the end grip, the column chooser). */
14
+ endCell: boolean;
15
15
  loadError: React.ReactNode;
16
16
  empty: React.ReactNode;
17
17
  emptyLabel: string;
@@ -22,5 +22,5 @@ type StateRowsProps<Row> = {
22
22
  * in a sticky box of the visible width, so a wide table centres it in the viewport, not across
23
23
  * every column.
24
24
  */
25
- export declare function StateRows<Row>({ state, columns, size, totalColumns, selectable, expandEnabled, reorderable, menuCell, loadError, empty, emptyLabel, skeletonRows, }: StateRowsProps<Row>): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
25
+ export declare function StateRows<Row>({ state, columns, size, totalColumns, selectable, expandEnabled, gripStart, endCell, loadError, empty, emptyLabel, skeletonRows, }: StateRowsProps<Row>): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
26
26
  export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `columns` in the order of `order`. An id `order` does not list (a column added to the code later)
3
+ * stands right after the column that precedes it in `columns`, so a saved order never hides it;
4
+ * ids of columns that are gone are skipped.
5
+ */
6
+ export declare function orderColumns<C extends {
7
+ id: string;
8
+ }>(columns: readonly C[], order: readonly string[]): C[];
9
+ /**
10
+ * The order of every column (hidden ones too) once the visible column `id` stands in front of the
11
+ * visible column `before` — or right after the last visible one when `before` is null, so a hidden
12
+ * column after it keeps its slot; `null` when that would shift a column that holds its place.
13
+ */
14
+ export declare function placeColumn(order: readonly string[], visible: readonly string[], id: string, before: string | null, locked: ReadonlySet<string>): string[] | null;
@@ -2,6 +2,8 @@ import * as React from "react";
2
2
  import type { FlatRow } from "./rows";
3
3
  /** What every row needs to know about reordering (part of the rows' shared props). */
4
4
  export type RowReorderShared = {
5
+ /** Where a row is picked up: a grip cell leading or ending it, or the row itself. */
6
+ handle: "start" | "end" | "row";
5
7
  /** The table is sorted by a column: the manual order is not what is on screen. */
6
8
  locked: boolean;
7
9
  /** `aria-label` of a row's handle; `{label}` is `getRowLabel(row)`. */
@@ -14,6 +16,8 @@ type Entry<Row> = {
14
16
  index: number;
15
17
  };
16
18
  export type RowReorderOptions<Row> = {
19
+ /** `reorderHandle`: a grip cell at the start or the end of a row, or the whole row. */
20
+ handle: "start" | "end" | "row";
17
21
  onReorder: ((id: React.Key, beforeId: React.Key | null) => void | Promise<void>) | undefined;
18
22
  /** Expandable rows (sub-rows, detail panels) do not reorder: a row would leave its children. */
19
23
  expandEnabled: boolean;
@@ -47,6 +51,8 @@ type ReorderBodyProps<Row> = {
47
51
  entries: Entry<Row>[];
48
52
  /** First index of the run among the rows on screen. */
49
53
  start: number;
54
+ /** Only a row's grip picks it up (`reorderHandle` `start` / `end`); else the whole row. */
55
+ handle: boolean;
50
56
  locked: boolean;
51
57
  onReorder: (id: string, beforeId: string | null) => void | Promise<void>;
52
58
  getRowLabel: ((row: Row) => string) | undefined;
@@ -55,8 +61,11 @@ type ReorderBodyProps<Row> = {
55
61
  header?: React.ReactNode;
56
62
  className?: string | undefined;
57
63
  };
58
- /** A `<tbody>` whose rows reorder: Dnd's sortable list in its table-rows mode, by the handle only. */
59
- export declare function ReorderBody<Row>({ entries, start, locked, onReorder, getRowLabel, renderRow, header, className, }: ReorderBodyProps<Row>): import("react/jsx-runtime").JSX.Element;
64
+ /**
65
+ * A `<tbody>` whose rows reorder: Dnd's sortable list in its table-rows mode, by the grip only, or
66
+ * by the whole row (`reorderHandle="row"`: the row is the keyboard target and the drag source).
67
+ */
68
+ export declare function ReorderBody<Row>({ entries, start, handle, locked, onReorder, getRowLabel, renderRow, header, className, }: ReorderBodyProps<Row>): import("react/jsx-runtime").JSX.Element;
60
69
  /** The drag session the rows need; it joins one the app already has above the table. */
61
70
  export declare function ReorderRoot({ enabled, children, }: {
62
71
  enabled: boolean;
@@ -72,7 +81,7 @@ type RowElementProps = Omit<React.ComponentProps<"tr">, "ref"> & {
72
81
  * A body row's `<tr>`; in a reorderable table, a sortable item rendered as that `<tr>` (it needs no
73
82
  * DOM id: only expandable rows are pointed at, and those do not reorder).
74
83
  */
75
- export declare function RowElement({ reorder, rowKey, rowRef, id, children, ...rest }: RowElementProps): import("react/jsx-runtime").JSX.Element;
84
+ export declare function RowElement({ reorder, rowKey, rowRef, id, tabIndex, children, ...rest }: RowElementProps): import("react/jsx-runtime").JSX.Element;
76
85
  type HandleCellProps = {
77
86
  reorder: RowReorderShared;
78
87
  rowLabel: string | undefined;
@@ -81,8 +90,9 @@ type HandleCellProps = {
81
90
  wrap?: (node: React.ReactNode) => React.ReactNode;
82
91
  };
83
92
  /**
84
- * The leading cell of a reorderable row: the grip (Alt + ↑ / ↓ from the keyboard; busy while the
85
- * owner saves this row's move) and, while the table is sorted, a disabled grip that says why.
93
+ * The grip cell of a reorderable row, leading or ending it (`reorderHandle`): the grip (Alt + ↑ / ↓
94
+ * from the keyboard; busy while the owner saves this row's move) and, while the table is sorted, a
95
+ * disabled grip that says why.
86
96
  */
87
97
  export declare function ReorderHandleCell({ reorder, rowLabel, className, wrap }: HandleCellProps): import("react/jsx-runtime").JSX.Element;
88
98
  export {};
@@ -54,6 +54,11 @@ export type DataTableColumn<Row> = {
54
54
  * key column that names the row — it stays even when its id is listed.
55
55
  */
56
56
  hideable?: boolean;
57
+ /**
58
+ * The column can move when columns reorder (`columnOrder`). Default `true`; `false` holds its
59
+ * place: it never moves and no column moves past it.
60
+ */
61
+ reorderable?: boolean;
57
62
  /**
58
63
  * Heatmap: each cell is shaded by its numeric value (`sortAccessor`, else `accessor`) on the
59
64
  * five-step chart scale (`--prime-color-chart-scale-1…5`); the value itself stays in the cell.
@@ -8,8 +8,12 @@ import * as React from "react";
8
8
  * (`col[data-grow]`) keep taking the free width.
9
9
  */
10
10
  export declare function useFrozenColumns(tableRef: React.RefObject<HTMLTableElement | null>, rootRef: React.RefObject<HTMLDivElement | null>,
11
- /** Changes with the column set: widths start from scratch. */
12
- columnsKey: string,
11
+ /**
12
+ * One key per `<col>`, in order. A new set of columns starts the widths from scratch; the same
13
+ * set in another order (columns that changed places, a carried column's gap) keeps every
14
+ * column's width and only moves it, so nothing reflows while columns reorder.
15
+ */
16
+ slots: readonly string[],
13
17
  /** Changes with the rendered rows: widths widen when content no longer fits. */
14
18
  rowsKey: unknown,
15
19
  /** Real rows are on screen (not loading, empty or error). */
@@ -39,7 +39,7 @@ export type CalendarOptions = {
39
39
  */
40
40
  months?: 1 | 2;
41
41
  /**
42
- * Preset column (`range` only): `DEFAULT_DATEPICKER_PRESETS` or picks from `datepickerPresets`; a row above the calendar when narrow.
42
+ * Preset column (`range` only): `DEFAULT_DATEPICKER_PRESETS` (ends with «Всё время») or picks from `datepickerPresets`; a row above the calendar when narrow.
43
43
  */
44
44
  presets?: DatepickerPreset[] | false;
45
45
  /**
@@ -108,15 +108,15 @@ export type DndSortableProps<T> = Omit<React.HTMLAttributes<HTMLElement>, "child
108
108
  */
109
109
  empty?: React.ReactNode;
110
110
  /**
111
- * Root element; `ul` / `ol` render items as `li`, `tbody` as table rows `tr` (the gap is a row across every column, the carried copy keeps every cell's width).
111
+ * Root element; `ul` / `ol` render items as `li`, `tbody` as rows `tr` (a gap row, a one-row copy), `tr` as head cells `th` with `axis="x"` (cells keep their columns, the gap glides among them).
112
112
  */
113
- as?: "div" | "ul" | "ol" | "tbody";
113
+ as?: "div" | "ul" | "ol" | "tbody" | "tr";
114
114
  /**
115
115
  * Accessible name of the list.
116
116
  */
117
117
  "aria-label"?: string;
118
118
  /**
119
- * Content in front of the items that never moves and takes no drop position: the heading row of a group in a `tbody`.
119
+ * Content in front of the items that never moves and takes no drop position: the heading row of a group in a `tbody`, the leading cells of a head row.
120
120
  */
121
121
  header?: React.ReactNode;
122
122
  /**
@@ -146,6 +146,10 @@ export type DndSortableItemProps = {
146
146
  * Holds its place: it does not move and nothing is put where it would shift it. Its `Dnd.Handle` turns into a lock. A pinned first row, a system column.
147
147
  */
148
148
  locked?: boolean;
149
+ /**
150
+ * Without `handle`: a press on a control inside picks the item up too once it travels (a finger: holds); a click stays the control's. A table header whose sort button fills it.
151
+ */
152
+ dragFromControls?: boolean;
149
153
  /**
150
154
  * The row look: fill, radius, padding.
151
155
  */
@@ -155,12 +159,12 @@ export type DndSortableItemProps = {
155
159
  */
156
160
  children?: React.ReactNode;
157
161
  ref?: React.Ref<HTMLElement>;
158
- } & Omit<React.HTMLAttributes<HTMLElement>, "id">;
162
+ } & Omit<React.HTMLAttributes<HTMLElement>, "id"> & Pick<React.ThHTMLAttributes<HTMLTableCellElement>, "scope">;
159
163
  /**
160
164
  * One item of a `Dnd.Sortable`. Renders `li` inside `ul` / `ol`, `tr` inside `tbody`, `div` otherwise.
161
165
  * The item is the keyboard target (a `div` one is a named `button`), or with `handle` its grip is.
162
166
  */
163
- declare function DndSortableItem({ id, disabled: itemDisabled, locked, className, children, onPointerDown, onKeyDown, onDragStart, ref, ...rest }: DndSortableItemProps): import("react/jsx-runtime").JSX.Element;
167
+ declare function DndSortableItem({ id, disabled: itemDisabled, locked, dragFromControls, className, children, onPointerDown, onKeyDown, onDragStart, ref, ...rest }: DndSortableItemProps): import("react/jsx-runtime").JSX.Element;
164
168
  declare namespace DndSortableItem {
165
169
  var displayName: string;
166
170
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shifts the cells of `row` while `draggingId` is carried and the gap stands in front of
3
+ * `gapBefore`. A drop (the order changed) takes the shifts off in the same frame the cells take
4
+ * their new places, which are the places they were drawn at (each column keeps its width); a
5
+ * cancel glides them back.
6
+ */
7
+ export declare function useInPlaceShift(row: HTMLElement | null, order: readonly string[], draggingId: string | null, gapBefore: string | null | undefined): void;
@@ -1,6 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { DragItem, DragOutcome } from "./dragSession";
3
3
  import type { Point, Rect } from "./geometry";
4
+ /** Set by `Dnd.SortableItem dragFromControls`: a press on a control inside picks the item up too. */
5
+ export declare const DRAG_FROM_CONTROLS = "data-dnd-drag-controls";
4
6
  export type DragSourceItem<TData> = {
5
7
  id: string;
6
8
  data: TData;
@@ -31,6 +31,11 @@ export type SortableListOptions = {
31
31
  canDrop?: ((id: string) => DropVerdict) | undefined;
32
32
  /** Only a press on a `[data-dnd-handle]` element starts a drag. */
33
33
  handleOnly?: boolean | undefined;
34
+ /**
35
+ * The items keep their places in the layout while one is carried (the cells of a table's head
36
+ * row stay in their columns): the host shifts them aside itself, nothing glides here mid-drag.
37
+ */
38
+ inPlace?: boolean | undefined;
34
39
  };
35
40
  export type SortableItemProps = DragSourceProps & {
36
41
  "data-lifted"?: true | undefined;
@@ -5,13 +5,23 @@ import type { ControlSize } from "../../internal/states";
5
5
  export type FieldListLabels = {
6
6
  /** `aria-label` of a row's remove button; `{row}` is the row's name. */
7
7
  remove: string;
8
- /** `aria-label` of a row's drag handle (`reorderable`); `{row}` is the row's name. */
8
+ /** `aria-label` of a row's drag handle; `{row}` is the row's name. */
9
9
  reorder: string;
10
+ /** `aria-label` of a row's actions menu button (`rowActions="menu"`); `{row}` is the row's name. */
11
+ actions: string;
12
+ /** Menu item that moves the row one place up. */
13
+ moveUp: string;
14
+ /** Menu item that moves the row one place down. */
15
+ moveDown: string;
16
+ /** Menu item that removes the row. */
17
+ removeItem: string;
18
+ /** Announced after a move from the menu or its keys; `{row}`, `{position}`, `{total}`. */
19
+ moved: string;
10
20
  /** Name of a row without `getLabel` text; `{index}` counts from 1. */
11
21
  row: string;
12
22
  /** Name of a row with `getLabel` text; `{label}` is that text. */
13
23
  namedRow: string;
14
- /** Why the remove button of a `getLocked` row is off: its tooltip and description. */
24
+ /** Why a pinned row cannot be removed: the tooltip of its remove button, the note in its menu. */
15
25
  lockedReason: string;
16
26
  /** Text beside the disabled add button once the list holds `max` rows; `{max}` is the limit. */
17
27
  maxReached: string;
@@ -42,6 +52,10 @@ export type FieldListRow<T> = {
42
52
  /** Takes the row out of the list (the row's remove button does the same). */
43
53
  remove: () => void;
44
54
  };
55
+ /** How a row offers its remove and its moves. */
56
+ export type FieldListRowActions = "buttons" | "menu";
57
+ /** The look of the list: on a fill of its own, or on the host surface. */
58
+ export type FieldListVariant = "plain" | "surface";
45
59
  export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange"> & {
46
60
  /**
47
61
  * The rows (controlled).
@@ -64,7 +78,7 @@ export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange
64
78
  */
65
79
  columns: readonly FieldListColumn[];
66
80
  /**
67
- * The cells of a row, one element per column (a fragment): kit fields without `label`. `row` has `index`, `update(patch)` and `remove()`. In one column the remove is the field's last segment.
81
+ * The cells of a row, one element per column (a fragment): kit fields without `label`. `row` has `index`, `update(patch)` and `remove()`.
68
82
  */
69
83
  renderItem: (item: T, row: FieldListRow<T>) => React.ReactNode;
70
84
  /**
@@ -80,17 +94,25 @@ export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange
80
94
  */
81
95
  addLabel?: string;
82
96
  /**
83
- * The row's own text (its title field) for the remove button, the handle and drag announcements; else the row number.
97
+ * The row's own text (its title field) for the remove button, the handle, the menu button and move announcements; else the row number.
84
98
  */
85
99
  getLabel?: (item: T) => string;
86
100
  /**
87
- * Pinned rows: the remove button stays in its place, off, its tooltip says why (`labels.lockedReason`); with `reorderable` a lock takes the handle's place and the row holds it while others move.
101
+ * Pinned rows: the remove stays in its place, off, and says why (`labels.lockedReason`); with `reorderable` a lock takes the handle's place and the row holds it. In the menu every item is off.
88
102
  */
89
103
  getLocked?: (item: T) => boolean;
90
104
  /**
91
- * Rows move by a handle at the row's end, after the remove button: drag, a touch hold, Alt + ↑ / ↓.
105
+ * Rows move: with `rowActions="buttons"` by a handle that ends the row, after the remove button (drag, a touch hold, Alt + ↑ / ↓); with `"menu"` by its items «Выше» and «Ниже» and Alt + ↑ / ↓ on the menu button.
92
106
  */
93
107
  reorderable?: boolean;
108
+ /**
109
+ * How a row offers its actions: `buttons` — a remove button «×» and, with `reorderable`, the handle after it; `menu` — one «⋯» button whose menu moves the row up or down and removes it.
110
+ */
111
+ rowActions?: FieldListRowActions;
112
+ /**
113
+ * Look of the list: `plain` — the rows on the host surface; `surface` — the rows on a fill of their own, one step up the surface ladder, with side padding.
114
+ */
115
+ variant?: FieldListVariant;
94
116
  /**
95
117
  * The fewest rows: at this count the remove buttons are disabled.
96
118
  */
@@ -116,7 +138,7 @@ export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange
116
138
  */
117
139
  error?: React.ReactNode;
118
140
  /**
119
- * Disables every field, handle and button; a disabled `Fieldset` around it sets it too.
141
+ * Disables every field, handle, button and menu button; a disabled `Fieldset` around it sets it too.
120
142
  */
121
143
  disabled?: boolean;
122
144
  /**
@@ -129,12 +151,12 @@ export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange
129
151
  labels?: Partial<FieldListLabels>;
130
152
  };
131
153
  /**
132
- * An editable list of records of the same shape: one row per record, the column headings shown
133
- * once above the rows, a remove button per row, an add button under them, an optional handle to
134
- * reorder and pinned rows. In a narrow container the rows stack into blocks and each field shows
135
- * its own label.
154
+ * An editable list of records of the same shape: one row per record on one grid, the column
155
+ * headings shown once above the rows, the row's actions at its end (a remove button and a handle,
156
+ * or one menu), an add button under them and pinned rows. In a narrow container a row keeps its
157
+ * first fields and its actions on one line and puts the rest under them, each with its label.
136
158
  */
137
- export declare function FieldList<T extends object>({ value: valueProp, defaultValue, onValueChange, getId, columns, renderItem, renderTotals, createItem, addLabel, getLabel, getLocked, reorderable, min, max, label, hint, hintTone, error, disabled: disabledProp, size: sizeProp, labels: labelsProp, className, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest }: FieldListProps<T>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
159
+ export declare function FieldList<T extends object>({ value: valueProp, defaultValue, onValueChange, getId, columns, renderItem, renderTotals, createItem, addLabel, getLabel, getLocked, reorderable, rowActions, variant, min, max, label, hint, hintTone, error, disabled: disabledProp, size: sizeProp, labels: labelsProp, className, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest }: FieldListProps<T>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
138
160
  export declare namespace FieldList {
139
161
  var displayName: string;
140
162
  }
@@ -122,7 +122,7 @@ export type GanttProps<Row, Bar extends GanttBar = GanttBar> = Omit<React.HTMLAt
122
122
  */
123
123
  empty?: React.ReactNode;
124
124
  /**
125
- * Content at the start of the toolbar (title, filters, a primary action); the zoom and «Сегодня» sit at its end.
125
+ * Content at the start of the toolbar (title, a legend, filters), kept together in the free room; «Сегодня» and the zoom keep their width at its end, and on a narrow chart they take the next line, the zoom filling it.
126
126
  */
127
127
  toolbar?: React.ReactNode;
128
128
  /**