prime-ui-kit 0.18.0 → 0.19.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.
Files changed (104) hide show
  1. package/dist/chunks/{chunk-OAXJWF3L.js → chunk-RZNGLELR.js} +120 -114
  2. package/dist/chunks/{chunk-MB4CXSLL.js → chunk-WYCTXD63.js} +832 -619
  3. package/dist/chunks/{chunk-X3JT5CLR.js → chunk-ZTZ2ML2B.js} +1 -1
  4. package/dist/color-picker.js +2 -2
  5. package/dist/components/data-table/ColumnsMenu.d.ts +16 -20
  6. package/dist/components/data-table/DataTable.d.ts +14 -11
  7. package/dist/components/data-table/Head.d.ts +8 -1
  8. package/dist/components/data-table/Row.d.ts +7 -1
  9. package/dist/components/data-table/StateRows.d.ts +3 -1
  10. package/dist/components/field-list/FieldList.d.ts +8 -8
  11. package/dist/components/index.d.ts +1 -1
  12. package/dist/components/kanban/Kanban.d.ts +4 -0
  13. package/dist/components/list/List.d.ts +9 -4
  14. package/dist/index.css +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/internal/fieldCell.d.ts +6 -0
  17. package/dist/internal/leaveGuard.d.ts +6 -0
  18. package/dist/internal/overlay/DialogGuard.d.ts +3 -2
  19. package/dist/internal/overlay/DialogParts.d.ts +14 -5
  20. package/dist/layout/index.d.ts +1 -1
  21. package/dist/layout/page/Page.d.ts +1 -7
  22. package/dist/skill/anti-slop.md +23 -0
  23. package/dist/skill/api-contract.md +1 -1
  24. package/dist/skill/cheatsheet.md +7 -3
  25. package/dist/skill/checklist.md +4 -0
  26. package/dist/skill/composition.md +70 -12
  27. package/dist/skill/layouts.md +1 -1
  28. package/dist/skill/reference/components/confirm-dialog/COMPONENT.md +1 -1
  29. package/dist/skill/reference/components/data-table/COMPONENT.md +40 -40
  30. package/dist/skill/reference/components/data-table/examples/actions-column.tsx +154 -0
  31. package/dist/skill/reference/components/data-table/examples/columns-visibility.tsx +3 -12
  32. package/dist/skill/reference/components/data-table/examples/controlled.tsx +1 -1
  33. package/dist/skill/reference/components/data-table/examples/narrow.tsx +4 -11
  34. package/dist/skill/reference/components/data-table/examples/row-link.tsx +18 -22
  35. package/dist/skill/reference/components/data-table/examples/screen.tsx +12 -1
  36. package/dist/skill/reference/components/data-table/examples/toolbar.tsx +26 -32
  37. package/dist/skill/reference/components/dnd/COMPONENT.md +4 -3
  38. package/dist/skill/reference/components/dnd/examples/examples.module.css +4 -3
  39. package/dist/skill/reference/components/dnd/examples/handle.tsx +5 -5
  40. package/dist/skill/reference/components/dnd/examples/locked.tsx +1 -1
  41. package/dist/skill/reference/components/dnd/examples/table.tsx +6 -6
  42. package/dist/skill/reference/components/drawer/COMPONENT.md +26 -10
  43. package/dist/skill/reference/components/drawer/examples/header-actions.tsx +1 -1
  44. package/dist/skill/reference/components/drawer/examples/loading.tsx +58 -0
  45. package/dist/skill/reference/components/field-list/COMPONENT.md +29 -25
  46. package/dist/skill/reference/components/field-list/examples/base-row.tsx +2 -1
  47. package/dist/skill/reference/components/field-list/examples/locked.tsx +11 -11
  48. package/dist/skill/reference/components/field-list/examples/reorder.tsx +1 -1
  49. package/dist/skill/reference/components/field-list/examples/screen.module.css +1 -1
  50. package/dist/skill/reference/components/field-list/examples/screen.tsx +168 -162
  51. package/dist/skill/reference/components/field-list/examples/totals.tsx +9 -8
  52. package/dist/skill/reference/components/kanban/COMPONENT.md +6 -2
  53. package/dist/skill/reference/components/kanban/examples/states.tsx +7 -5
  54. package/dist/skill/reference/components/list/COMPONENT.md +21 -11
  55. package/dist/skill/reference/components/list/examples/reorder.tsx +42 -7
  56. package/dist/skill/reference/components/modal/COMPONENT.md +23 -10
  57. package/dist/skill/reference/components/segmented-control/COMPONENT.md +3 -2
  58. package/dist/skill/reference/components/sheet/COMPONENT.md +18 -7
  59. package/dist/skill/reference/layout/page/COMPONENT.md +5 -12
  60. package/dist/skill/reference/layout/page/examples/screen.module.css +1 -1
  61. package/dist/skill/reference/layout/page/examples/screen.tsx +93 -104
  62. package/dist/skill/reference/layout/page/examples/sections.tsx +2 -15
  63. package/dist/skill/responsive.md +7 -5
  64. package/dist/tokens/semantic.d.ts +1 -1
  65. package/dist/tokens/themes/dark.d.ts +1 -1
  66. package/package.json +1 -1
  67. package/src/components/confirm-dialog/COMPONENT.md +1 -1
  68. package/src/components/data-table/COMPONENT.md +40 -40
  69. package/src/components/data-table/examples/actions-column.tsx +154 -0
  70. package/src/components/data-table/examples/columns-visibility.tsx +3 -12
  71. package/src/components/data-table/examples/controlled.tsx +1 -1
  72. package/src/components/data-table/examples/narrow.tsx +4 -11
  73. package/src/components/data-table/examples/row-link.tsx +18 -22
  74. package/src/components/data-table/examples/screen.tsx +12 -1
  75. package/src/components/data-table/examples/toolbar.tsx +26 -32
  76. package/src/components/dnd/COMPONENT.md +4 -3
  77. package/src/components/dnd/examples/examples.module.css +4 -3
  78. package/src/components/dnd/examples/handle.tsx +5 -5
  79. package/src/components/dnd/examples/locked.tsx +1 -1
  80. package/src/components/dnd/examples/table.tsx +6 -6
  81. package/src/components/drawer/COMPONENT.md +26 -10
  82. package/src/components/drawer/examples/header-actions.tsx +1 -1
  83. package/src/components/drawer/examples/loading.tsx +58 -0
  84. package/src/components/field-list/COMPONENT.md +29 -25
  85. package/src/components/field-list/examples/base-row.tsx +2 -1
  86. package/src/components/field-list/examples/locked.tsx +11 -11
  87. package/src/components/field-list/examples/reorder.tsx +1 -1
  88. package/src/components/field-list/examples/screen.module.css +1 -1
  89. package/src/components/field-list/examples/screen.tsx +168 -162
  90. package/src/components/field-list/examples/totals.tsx +9 -8
  91. package/src/components/kanban/COMPONENT.md +6 -2
  92. package/src/components/kanban/examples/states.tsx +7 -5
  93. package/src/components/list/COMPONENT.md +21 -11
  94. package/src/components/list/examples/reorder.tsx +42 -7
  95. package/src/components/modal/COMPONENT.md +23 -10
  96. package/src/components/segmented-control/COMPONENT.md +3 -2
  97. package/src/components/sheet/COMPONENT.md +18 -7
  98. package/src/layout/page/COMPONENT.md +5 -12
  99. package/src/layout/page/examples/screen.module.css +1 -1
  100. package/src/layout/page/examples/screen.tsx +93 -104
  101. package/src/layout/page/examples/sections.tsx +2 -15
  102. package/src/styles/theme-dark.css +1 -1
  103. package/src/styles/theme-light.css +1 -1
  104. package/dist/components/data-table/context.d.ts +0 -14
@@ -0,0 +1,154 @@
1
+ /** Orders wider than the table: the order number stays at the start, the ⋯ row actions at the end with the column chooser in their header cell, and the columns between scroll sideways — `stickyFirstColumn`, `stickyLastColumn`, `columnsMenu`. */
2
+ import { Badge, Button, DataTable, type DataTableColumn, Dropdown, Icon } from "prime-ui-kit";
3
+
4
+ type Order = {
5
+ id: string;
6
+ client: string;
7
+ manager: string;
8
+ city: string;
9
+ address: string;
10
+ status: "new" | "paid" | "shipped" | "cancelled";
11
+ date: string;
12
+ items: number;
13
+ amount: number;
14
+ };
15
+
16
+ const ORDERS: Order[] = [
17
+ {
18
+ id: "З-2041",
19
+ client: "ООО «Северный ветер»",
20
+ manager: "Анна Смирнова",
21
+ city: "Санкт-Петербург",
22
+ address: "Лиговский пр., 50, склад 3",
23
+ status: "paid",
24
+ date: "02.10.2026",
25
+ items: 14,
26
+ amount: 184_500,
27
+ },
28
+ {
29
+ id: "З-2042",
30
+ client: "ИП Козлов",
31
+ manager: "Игорь Петров",
32
+ city: "Казань",
33
+ address: "ул. Петербургская, 12, офис 4",
34
+ status: "new",
35
+ date: "03.10.2026",
36
+ items: 3,
37
+ amount: 27_900,
38
+ },
39
+ {
40
+ id: "З-2043",
41
+ client: "АО «Технопарк»",
42
+ manager: "Анна Смирнова",
43
+ city: "Новосибирск",
44
+ address: "ул. Станционная, 38, терминал Б",
45
+ status: "shipped",
46
+ date: "05.10.2026",
47
+ items: 42,
48
+ amount: 612_000,
49
+ },
50
+ {
51
+ id: "З-2044",
52
+ client: "ООО «Лента Логистик»",
53
+ manager: "Мария Орлова",
54
+ city: "Екатеринбург",
55
+ address: "ул. Монтажников, 4, ворота 2",
56
+ status: "cancelled",
57
+ date: "06.10.2026",
58
+ items: 8,
59
+ amount: 96_300,
60
+ },
61
+ {
62
+ id: "З-2045",
63
+ client: "ООО «Гранит»",
64
+ manager: "Игорь Петров",
65
+ city: "Москва",
66
+ address: "Варшавское ш., 125, стр. 1",
67
+ status: "paid",
68
+ date: "08.10.2026",
69
+ items: 21,
70
+ amount: 275_400,
71
+ },
72
+ ];
73
+
74
+ const STATUS = {
75
+ new: { label: "Новый", tone: "info" },
76
+ paid: { label: "Оплачен", tone: "success" },
77
+ shipped: { label: "Отгружен", tone: "neutral" },
78
+ cancelled: { label: "Отменён", tone: "danger" },
79
+ } as const;
80
+
81
+ const RUB = new Intl.NumberFormat("ru-RU", {
82
+ style: "currency",
83
+ currency: "RUB",
84
+ maximumFractionDigits: 0,
85
+ });
86
+
87
+ const COLUMNS: DataTableColumn<Order>[] = [
88
+ { id: "id", header: "Заказ", accessor: "id", hideable: false },
89
+ { id: "client", header: "Клиент", accessor: "client", minWidth: "14rem" },
90
+ { id: "manager", header: "Менеджер", accessor: "manager", minWidth: "10rem" },
91
+ { id: "city", header: "Город", accessor: "city", minWidth: "10rem" },
92
+ { id: "address", header: "Адрес доставки", accessor: "address", minWidth: "18rem" },
93
+ {
94
+ id: "status",
95
+ header: "Статус",
96
+ cell: (row) => (
97
+ <Badge.Root tone={STATUS[row.status].tone}>{STATUS[row.status].label}</Badge.Root>
98
+ ),
99
+ },
100
+ { id: "date", header: "Дата", accessor: "date", numeric: true, headerAlign: "end" },
101
+ { id: "items", header: "Позиций", accessor: "items", numeric: true, headerAlign: "end" },
102
+ {
103
+ id: "amount",
104
+ header: "Сумма",
105
+ accessor: "amount",
106
+ numeric: true,
107
+ headerAlign: "end",
108
+ cell: (row) => RUB.format(row.amount),
109
+ },
110
+ {
111
+ id: "actions",
112
+ header: "Действия",
113
+ hideHeader: true,
114
+ hideable: false,
115
+ align: "end",
116
+ cell: (row) => (
117
+ <Dropdown.Root>
118
+ <Dropdown.Trigger>
119
+ <Button.Root
120
+ variant="ghost"
121
+ tone="neutral"
122
+ size="s"
123
+ aria-label={`Действия с заказом ${row.id}`}
124
+ >
125
+ <Button.Icon>
126
+ <Icon name="action.more" />
127
+ </Button.Icon>
128
+ </Button.Root>
129
+ </Dropdown.Trigger>
130
+ <Dropdown.Content>
131
+ <Dropdown.Item>Открыть</Dropdown.Item>
132
+ <Dropdown.Item>Скачать счёт</Dropdown.Item>
133
+ <Dropdown.Item>Повторить заказ</Dropdown.Item>
134
+ <Dropdown.Separator />
135
+ <Dropdown.Item tone="danger">Отменить</Dropdown.Item>
136
+ </Dropdown.Content>
137
+ </Dropdown.Root>
138
+ ),
139
+ },
140
+ ];
141
+
142
+ export default function DataTableActionsColumnExample() {
143
+ return (
144
+ <DataTable
145
+ columns={COLUMNS}
146
+ rows={ORDERS}
147
+ getRowKey={(row) => row.id}
148
+ paging="none"
149
+ stickyFirstColumn
150
+ stickyLastColumn
151
+ columnsMenu
152
+ />
153
+ );
154
+ }
@@ -1,9 +1,7 @@
1
- /** Orders with the column chooser in the toolbar; the choice outlives a reload in local storage, the order number always stays — `DataTable.ColumnsMenu`, `hiddenColumns`, `onHiddenColumnsChange`, `hideable`. */
2
- import { Badge, DataTable, type DataTableColumn, Typography } from "prime-ui-kit";
1
+ /** Orders with the column chooser at the end of the header row; the choice outlives a reload in local storage, the order number always stays — `columnsMenu`, `hiddenColumns`, `onHiddenColumnsChange`, `hideable`. */
2
+ import { Badge, DataTable, type DataTableColumn } from "prime-ui-kit";
3
3
  import * as React from "react";
4
4
 
5
- import styles from "./examples.module.css";
6
-
7
5
  type Status = "paid" | "shipped" | "waiting";
8
6
  type Order = {
9
7
  id: string;
@@ -138,14 +136,7 @@ export default function DataTableColumnsVisibilityExample() {
138
136
  rows={ORDERS}
139
137
  getRowKey={(row) => row.id}
140
138
  stickyFirstColumn
141
- toolbar={
142
- <div className={styles.toolbar}>
143
- <Typography as="span" variant="body-s" tone="secondary">
144
- Заказы за неделю: {ORDERS.length}
145
- </Typography>
146
- <DataTable.ColumnsMenu />
147
- </div>
148
- }
139
+ columnsMenu
149
140
  />
150
141
  );
151
142
  }
@@ -52,7 +52,7 @@ export default function DataTableControlledExample() {
52
52
  columns={COLUMNS}
53
53
  rows={ORDERS}
54
54
  getRowKey={(row) => row.id}
55
- toolbar={<DataTable.ColumnsMenu />}
55
+ columnsMenu
56
56
  hiddenColumns={hiddenColumns}
57
57
  onHiddenColumnsChange={setHiddenColumns}
58
58
  sort={sort}
@@ -1,5 +1,5 @@
1
- /** A 320 px support queue: columns scroll inside the table with the first one pinned, the toolbar and footer reflow and the pager turns compact — `stickyFirstColumn`, `size`. */
2
- import { Badge, Button, DataTable, type DataTableColumn, Typography } from "prime-ui-kit";
1
+ /** A 320 px support queue: columns scroll inside the table with the first one pinned, the column chooser stays at the end of the header row, the footer reflows and the pager turns compact — `stickyFirstColumn`, `columnsMenu`, `size`. */
2
+ import { Badge, DataTable, type DataTableColumn } from "prime-ui-kit";
3
3
 
4
4
  import styles from "./examples.module.css";
5
5
 
@@ -15,7 +15,7 @@ const TICKETS: Ticket[] = Array.from({ length: 36 }, (_, i) => ({
15
15
  }));
16
16
 
17
17
  const COLUMNS: DataTableColumn<Ticket>[] = [
18
- { id: "id", header: "Тикет", accessor: "id" },
18
+ { id: "id", header: "Тикет", accessor: "id", hideable: false },
19
19
  { id: "subject", header: "Тема", accessor: "subject", truncate: true, maxWidth: "10rem" },
20
20
  {
21
21
  id: "priority",
@@ -39,15 +39,8 @@ export default function DataTableNarrowExample() {
39
39
  rows={TICKETS}
40
40
  getRowKey={(row) => row.id}
41
41
  stickyFirstColumn
42
+ columnsMenu
42
43
  pageSize={5}
43
- toolbar={
44
- <div className={styles.toolbar}>
45
- <Typography as="span" variant="body-s" tone="secondary">
46
- Открытые: {TICKETS.length}
47
- </Typography>
48
- <Button.Root size="xs">Новый тикет</Button.Root>
49
- </div>
50
- }
51
44
  />
52
45
  </div>
53
46
  );
@@ -2,8 +2,6 @@
2
2
  import { Button, DataTable, type DataTableColumn, Dropdown, Icon, Typography } from "prime-ui-kit";
3
3
  import * as React from "react";
4
4
 
5
- import styles from "./examples.module.css";
6
-
7
5
  type Invoice = { id: string; client: string; due: string; amount: number; total?: boolean };
8
6
 
9
7
  const INVOICES: Invoice[] = [
@@ -77,25 +75,23 @@ export default function DataTableRowLinkExample() {
77
75
  ];
78
76
 
79
77
  return (
80
- <DataTable
81
- columns={columns}
82
- rows={ROWS}
83
- getRowKey={(row) => row.id}
84
- paging="none"
85
- getRowHref={(row) => `/invoices/${row.id}`}
86
- isRowClickable={(row) => !row.total}
87
- onRowClick={(row, _index, event) => {
88
- // A client-side router goes here (navigate(href)); the page itself never reloads.
89
- event.preventDefault();
90
- setStatus(`Открыт ${row.id} · ${row.client}`);
91
- }}
92
- toolbar={
93
- <div className={styles.toolbar}>
94
- <Typography as="span" variant="body-s" tone="secondary" aria-live="polite">
95
- {status}
96
- </Typography>
97
- </div>
98
- }
99
- />
78
+ <>
79
+ <DataTable
80
+ columns={columns}
81
+ rows={ROWS}
82
+ getRowKey={(row) => row.id}
83
+ paging="none"
84
+ getRowHref={(row) => `/invoices/${row.id}`}
85
+ isRowClickable={(row) => !row.total}
86
+ onRowClick={(row, _index, event) => {
87
+ // A client-side router goes here (navigate(href)); the page itself never reloads.
88
+ event.preventDefault();
89
+ setStatus(`Открыт ${row.id} · ${row.client}`);
90
+ }}
91
+ />
92
+ <Typography as="span" variant="body-s" tone="secondary" aria-live="polite">
93
+ {status}
94
+ </Typography>
95
+ </>
100
96
  );
101
97
  }
@@ -177,7 +177,15 @@ const initials = (name: string) =>
177
177
  .toUpperCase();
178
178
 
179
179
  const COLUMNS: DataTableColumn<Invoice>[] = [
180
- { id: "id", header: "Счёт", accessor: "id", sortable: true, numeric: true, align: "start" },
180
+ {
181
+ id: "id",
182
+ header: "Счёт",
183
+ accessor: "id",
184
+ sortable: true,
185
+ numeric: true,
186
+ align: "start",
187
+ hideable: false,
188
+ },
181
189
  {
182
190
  id: "client",
183
191
  header: "Клиент",
@@ -230,6 +238,7 @@ const COLUMNS: DataTableColumn<Invoice>[] = [
230
238
  id: "actions",
231
239
  header: "Действия",
232
240
  hideHeader: true,
241
+ hideable: false,
233
242
  width: "3.5rem",
234
243
  align: "end",
235
244
  cell: (row) => (
@@ -320,6 +329,8 @@ export default function DataTableScreenExample() {
320
329
  getRowLabel={(row) => `Счёт ${row.id}`}
321
330
  pageSize={6}
322
331
  stickyFirstColumn
332
+ stickyLastColumn
333
+ columnsMenu
323
334
  defaultSort={{ columnId: "due", order: "desc" }}
324
335
  empty={
325
336
  <EmptyPage.Root size="s" role="status" aria-labelledby="invoices-empty">
@@ -1,7 +1,6 @@
1
- /** A campaign list with search, a status filter and export above the table; the empty text when nothing matches — `toolbar`, `empty`. */
1
+ /** A campaign table with its own search and status filter above it — two table-scoped controls; the empty text when nothing matches — `toolbar`, `empty`. */
2
2
  import {
3
3
  Badge,
4
- Button,
5
4
  DataTable,
6
5
  type DataTableColumn,
7
6
  Icon,
@@ -87,36 +86,31 @@ export default function DataTableToolbarExample() {
87
86
  pageSize={5}
88
87
  empty="Ничего не найдено — измените запрос или фильтр"
89
88
  toolbar={
90
- <div className={styles.toolbar}>
91
- <div className={styles.filters}>
92
- <Input.Root size="s" className={styles.search}>
93
- <Input.Wrapper>
94
- <Input.Icon side="start">
95
- <Icon name="action.search" />
96
- </Input.Icon>
97
- <Input.Field
98
- type="search"
99
- placeholder="Поиск кампаний"
100
- aria-label="Поиск кампаний"
101
- value={query}
102
- onValueChange={setQuery}
103
- />
104
- </Input.Wrapper>
105
- </Input.Root>
106
- <SegmentedControl.Root
107
- size="s"
108
- aria-label="Статус"
109
- value={status}
110
- onValueChange={setStatus}
111
- >
112
- <SegmentedControl.Item value="all">Все</SegmentedControl.Item>
113
- <SegmentedControl.Item value="active">Активные</SegmentedControl.Item>
114
- <SegmentedControl.Item value="paused">На паузе</SegmentedControl.Item>
115
- </SegmentedControl.Root>
116
- </div>
117
- <Button.Root variant="outline" tone="neutral" size="s">
118
- Экспорт
119
- </Button.Root>
89
+ <div className={styles.filters}>
90
+ <Input.Root size="s" className={styles.search}>
91
+ <Input.Wrapper>
92
+ <Input.Icon side="start">
93
+ <Icon name="action.search" />
94
+ </Input.Icon>
95
+ <Input.Field
96
+ type="search"
97
+ placeholder="Поиск кампаний"
98
+ aria-label="Поиск кампаний"
99
+ value={query}
100
+ onValueChange={setQuery}
101
+ />
102
+ </Input.Wrapper>
103
+ </Input.Root>
104
+ <SegmentedControl.Root
105
+ size="s"
106
+ aria-label="Статус"
107
+ value={status}
108
+ onValueChange={setStatus}
109
+ >
110
+ <SegmentedControl.Item value="all">Все</SegmentedControl.Item>
111
+ <SegmentedControl.Item value="active">Активные</SegmentedControl.Item>
112
+ <SegmentedControl.Item value="paused">На паузе</SegmentedControl.Item>
113
+ </SegmentedControl.Root>
120
114
  </div>
121
115
  }
122
116
  />
@@ -30,7 +30,7 @@ Dnd.Root session owner: overlay (portal), live region, l
30
30
  ├─ Dnd.Sortable list container and drop target; renders items in the drawn order
31
31
  │ ├─ header optional content before the items that never moves (a group's heading row)
32
32
  │ ├─ Dnd.SortableItem one item (li in ul/ol, div otherwise); the gap is drawn before it
33
- │ │ └─ Dnd.Handle optional grip: a ghost icon-only Button (with `handle` on the list); a lock in a `locked` item; busy while the item's move is saved
33
+ │ │ └─ Dnd.Handle optional grip, last in the item: a ghost icon-only Button (with `handle` on the list); a lock in a `locked` item; busy while the item's move is saved
34
34
  │ ├─ empty the `empty` content while the list has no items
35
35
  │ └─ children optional content after the items that never moves (an add tile)
36
36
  ├─ Dnd.Draggable an item to carry elsewhere; stays in place, faded, until the drop
@@ -85,7 +85,7 @@ Generic `Dnd.Sortable<T>`; `ref` → `HTMLElement`. The list and its drop target
85
85
  | `…rest` | `Omit<HTMLAttributes<HTMLElement>, "id">` | — | `aria-labelledby` / `aria-describedby` (the visible title and description) and the other attributes. |
86
86
 
87
87
  ### Dnd.Handle
88
- `ref` → `HTMLButtonElement` (`HTMLSpanElement` in a `locked` item). The grip: a ghost icon-only `xs` Button that starts the drag and takes the item's keys; busy while the item's move is saved. In a `locked` item it is a lock.
88
+ `ref` → `HTMLButtonElement` (`HTMLSpanElement` in a `locked` item). The grip: a ghost icon-only `xs` Button that starts the drag and takes the item's keys; busy while saving. In a `locked` item it is a lock. Place it last in the item, after its controls.
89
89
 
90
90
  | Prop | Type | Default | Description |
91
91
  |---|---|---|---|
@@ -201,6 +201,7 @@ An item's own `onPointerDown` / `onKeyDown` run before the kit's: `preventDefaul
201
201
  ## Layout & spacing
202
202
  - The distance between items is `--prime-space-2`; a host sets `--dnd-sortable-gap` on the list for another one.
203
203
  - A grid (`axis="grid"`) is `display: grid`: the host sets the tracks (`grid-template-columns`) and the cells' size; the gap takes a cell, and a carried item resizes to the cell it would land in.
204
+ - A `Dnd.Handle` ends its item: the last child, after the item's own trailing controls (a remove button), at the inline end (on the left in RTL); a `locked` item's lock takes the same place, so the grips of every row stand on one line. In a table it is the last cell. An on / off switch leads the item (its first child), so its state reads first and nothing stands between the text and the grip.
204
205
  - The reason chip stands `--prime-tooltip-offset` under the carried copy, start-aligned, at most `--prime-tooltip-max-width` wide.
205
206
  - The look of a row is the consumer's: give `Dnd.SortableItem` / `Dnd.Draggable` a radius on its own class (the gap and the clone's fill take it) and keep the row's look within its ancestors up to the nearest surface (`data-depth`) — the clone flies inside empty copies (`display: contents`) of exactly those, so their variables and selectors still apply. A table row flies in a one-row copy of its table inside them.
206
207
  - A scrollable ancestor under the pointer auto-scrolls within 64 px of its edge (a `ScrollContainer` strip works).
@@ -251,7 +252,7 @@ An item's own `onPointerDown` / `onKeyDown` run before the kit's: `preventDefaul
251
252
  | Example | Shows |
252
253
  |---|---|
253
254
  | [overview.tsx](examples/overview.tsx) | Project tasks reordered by dragging the whole row; one root above, the move applied with a helper — `Dnd.Root`, `Dnd.Sortable`, `onReorder`, `moveBefore`. |
254
- | [handle.tsx](examples/handle.tsx) | Notification channels with switches: only the grip starts a drag, and the async save can roll the order back — `handle`, `Dnd.Handle`, `onReorder`. |
255
+ | [handle.tsx](examples/handle.tsx) | Notification channels, each switch leading its row and the grip ending it: only the grip starts a drag, and the async save can roll the order back — `handle`, `Dnd.Handle`, `onReorder`. |
255
256
  | [grid.tsx](examples/grid.tsx) | Product photos in a wrapping grid: a photo carried across rows lands in reading order, the gap takes a cell, Alt + ← / → steps it one place — `axis`. |
256
257
  | [locked.tsx](examples/locked.tsx) | Sections of a workspace menu: the home section is pinned first with a lock in place of its grip, the rest reorder around nothing past it; each row is named by its visible title — `locked`, `handle`, `aria-labelledby`. |
257
258
  | [board.tsx](examples/board.tsx) | A ticket board: columns share one kind, so a ticket lands in another column at an exact position or moves there with Alt + ← / →, an empty column says so, and a full column refuses it before the release with the reason under the ticket — `kind`, `canDrop`, `empty`, `onReorder`. |
@@ -18,9 +18,9 @@
18
18
  box-shadow: var(--prime-shadow-raised);
19
19
  }
20
20
 
21
- /* The grip sits closer to the edge: it is a square button with its own inner room. */
21
+ /* The grip ends the row and sits closer to the edge: a square button with its own inner room. */
22
22
  .handleRow {
23
- padding-inline-start: var(--prime-space-2);
23
+ padding-inline-end: var(--prime-space-2);
24
24
  }
25
25
 
26
26
  .rowText {
@@ -134,9 +134,10 @@
134
134
  text-align: end;
135
135
  }
136
136
 
137
+ /* The grip column ends the row. */
137
138
  .grip {
138
139
  inline-size: var(--prime-space-10);
139
- padding-inline-end: 0;
140
+ padding-inline-start: 0;
140
141
  }
141
142
 
142
143
  /* A stage's heading row: a fill marks where a new stage starts. */
@@ -1,4 +1,4 @@
1
- /** Notification channels with switches: only the grip starts a drag, and the async save can roll the order back — `handle`, `Dnd.Handle`, `onReorder`. */
1
+ /** Notification channels, each switch leading its row and the grip ending it: only the grip starts a drag, and the async save can roll the order back — `handle`, `Dnd.Handle`, `onReorder`. */
2
2
  import { Dnd, moveBefore, Switch, Typography } from "prime-ui-kit";
3
3
  import * as React from "react";
4
4
 
@@ -37,10 +37,6 @@ export default function DndHandleExample() {
37
37
  }}
38
38
  renderItem={(channel) => (
39
39
  <Dnd.SortableItem id={channel.id} className={styles.handleRow}>
40
- <Dnd.Handle />
41
- <Typography as="span" variant="body-m" className={styles.rowText}>
42
- {channel.title}
43
- </Typography>
44
40
  <Switch.Root
45
41
  aria-label={channel.title}
46
42
  checked={channel.enabled}
@@ -50,6 +46,10 @@ export default function DndHandleExample() {
50
46
  )
51
47
  }
52
48
  />
49
+ <Typography as="span" variant="body-m" className={styles.rowText}>
50
+ {channel.title}
51
+ </Typography>
52
+ <Dnd.Handle />
53
53
  </Dnd.SortableItem>
54
54
  )}
55
55
  />
@@ -40,7 +40,6 @@ export default function DndLockedExample() {
40
40
  aria-labelledby={`${uid}-${section.id}`}
41
41
  aria-describedby={`${uid}-${section.id}-note`}
42
42
  >
43
- <Dnd.Handle aria-label={`Переместить раздел «${section.title}»`} />
44
43
  <span className={styles.rowText}>
45
44
  <Typography as="span" variant="body-m" id={`${uid}-${section.id}`}>
46
45
  {section.title}
@@ -49,6 +48,7 @@ export default function DndLockedExample() {
49
48
  {section.description}
50
49
  </Typography>
51
50
  </span>
51
+ <Dnd.Handle aria-label={`Переместить раздел «${section.title}»`} />
52
52
  </Dnd.SortableItem>
53
53
  )}
54
54
  />
@@ -51,9 +51,6 @@ export default function DndTableExample() {
51
51
  </caption>
52
52
  <thead>
53
53
  <tr>
54
- <th scope="col" className={styles.grip}>
55
- <VisuallyHidden>Порядок</VisuallyHidden>
56
- </th>
57
54
  <th scope="col" className={styles.cell}>
58
55
  <Typography as="span" variant="caption" tone="muted">
59
56
  Работа
@@ -64,6 +61,9 @@ export default function DndTableExample() {
64
61
  Часы
65
62
  </Typography>
66
63
  </th>
64
+ <th scope="col" className={styles.grip}>
65
+ <VisuallyHidden>Порядок</VisuallyHidden>
66
+ </th>
67
67
  </tr>
68
68
  </thead>
69
69
  {stages.map((stage) => (
@@ -90,9 +90,6 @@ export default function DndTableExample() {
90
90
  }
91
91
  renderItem={(line) => (
92
92
  <Dnd.SortableItem id={line.id}>
93
- <td className={styles.grip}>
94
- <Dnd.Handle />
95
- </td>
96
93
  <td className={styles.cell}>
97
94
  <Typography as="span" variant="body-m">
98
95
  {line.title}
@@ -103,6 +100,9 @@ export default function DndTableExample() {
103
100
  {line.hours}
104
101
  </Typography>
105
102
  </td>
103
+ <td className={styles.grip}>
104
+ <Dnd.Handle />
105
+ </td>
106
106
  </Dnd.SortableItem>
107
107
  )}
108
108
  />
@@ -81,7 +81,7 @@ No DOM, no ref. State and dismiss policy.
81
81
  | `…rest` | `HTMLAttributes<HTMLElement>` | — | `className` and the other attributes of the `<header>`. |
82
82
 
83
83
  ### Drawer.Actions
84
- `ref` → `HTMLDivElement`. A row of controls at the end of the header, before the close button: a status Badge, a ⋯ Dropdown, an icon button; or at the end of a `Drawer.Section` heading. Controls inside take tier `s`.
84
+ `ref` → `HTMLDivElement`. A row of controls at the end of the header, before the close button: a status Badge, a ⋯ Dropdown; under the title when it would get less than 12rem; or at the end of a `Drawer.Section` heading. Controls inside take tier `s`.
85
85
 
86
86
  | Prop | Type | Default | Description |
87
87
  |---|---|---|---|
@@ -96,12 +96,20 @@ No DOM, no ref. State and dismiss policy.
96
96
  | `children` | `ReactNode` | — (required) | An `Icon` (sized to the m icon), or the record's picture: an `Avatar.Root` (sized to the tile) or a `Thumbnail.Root`. |
97
97
  | `…rest` | `Omit<HTMLAttributes<HTMLSpanElement>, "children">` | — | `className` and the other attributes of the tile. |
98
98
 
99
- ### Drawer.Title · Drawer.Description
100
- `ref` → `HTMLHeadingElement` / `HTMLParagraphElement`. `<h2>` (title-m) / `<p>` (body-s, muted); their ids name and describe the dialog.
99
+ ### Drawer.Title
100
+ `ref` → `HTMLHeadingElement`. `<h2>` (title-m); its id names the dialog.
101
101
 
102
102
  | Prop | Type | Default | Description |
103
103
  |---|---|---|---|
104
- | `…rest` | `Omit<HTMLAttributes<HTMLHeadingElement \| HTMLParagraphElement>, "id">` | — | `className`, `children` and the other attributes except `id` (the dialog owns it). |
104
+ | `…rest` | `Omit<HTMLAttributes<HTMLHeadingElement>, "id">` | — | `className`, `children` and the other attributes except `id` (the dialog owns it). |
105
+
106
+ ### Drawer.Description
107
+ `ref` → `HTMLParagraphElement`. `<p>` (body-s, muted) under the title; its id describes the dialog.
108
+
109
+ | Prop | Type | Default | Description |
110
+ |---|---|---|---|
111
+ | `loading` | `boolean` | `false` | Its data loads: a `Skeleton` holds the line's place and `aria-busy` is set, so the header never moves; the data fades in. |
112
+ | `…rest` | `Omit<HTMLAttributes<HTMLParagraphElement>, "id">` | — | `className`, `children` and the other attributes except `id` (the dialog owns it). |
105
113
 
106
114
  ### Drawer.Body
107
115
  `ref` → `HTMLDivElement`. The only scrolling zone (a ScrollContainer), 16 gap between blocks.
@@ -111,7 +119,7 @@ No DOM, no ref. State and dismiss policy.
111
119
  | `…rest` | `HTMLAttributes<HTMLDivElement>` | — | `className`, `children` and the other attributes of the zone. |
112
120
 
113
121
  ### Drawer.Section
114
- `ref` → `HTMLElement`. A titled `<section>` of the body: an `<h3>` (title-s, under the `<h2>` title), an optional description, a `Drawer.Actions` at the end of the heading row; the content 16 below, sections 32 apart. Fields group in a `Fieldset`.
122
+ `ref` → `HTMLElement`. A titled `<section>` of the body: an `<h3>` (title-s, under the `<h2>` title), an optional description, a `Drawer.Actions` at the end of the heading row; the content 16 below, sections 32 apart, in any wrapper. Fields group in a `Fieldset`.
115
123
 
116
124
  | Prop | Type | Default | Description |
117
125
  |---|---|---|---|
@@ -124,7 +132,7 @@ No DOM, no ref. State and dismiss policy.
124
132
 
125
133
  | Prop | Type | Default | Description |
126
134
  |---|---|---|---|
127
- | `layout` | `"fill" \| "end"` | `"end"` | `fill`: equal-width buttons in one row; `end`: auto width, at the end. Stacked on phones (viewport below 640 px) and in a dialog narrower than 360 px. |
135
+ | `layout` | `"fill" \| "end"` | `"end"` | `fill`: equal-width buttons in one row, wrapping rather than cutting a label; `end`: auto width, at the end. Stacked on phones (viewport below 640 px) and in a dialog narrower than 360 px. |
128
136
  | `…rest` | `HTMLAttributes<HTMLElement>` | — | `className`, `children` and the other attributes of the `<footer>`. |
129
137
 
130
138
  ### Drawer.Meta
@@ -135,7 +143,7 @@ No DOM, no ref. State and dismiss policy.
135
143
  | `…rest` | `HTMLAttributes<HTMLParagraphElement>` | — | `className`, `children` and the other attributes of the `<p>`. |
136
144
 
137
145
  ### Drawer.Guard
138
- No DOM, no ref. Holds the dialog from anywhere inside Content, where the form state lives; renders only the built-in «discard changes?» confirm. Closing from code is never held.
146
+ No DOM, no ref. Holds the dialog from anywhere inside Content, where the form state lives; renders only the built-in «discard changes?» confirm. While `busy` or `dirty` the browser also asks before the tab closes or reloads. Closing from code is never held.
139
147
 
140
148
  | Prop | Type | Default | Description |
141
149
  |---|---|---|---|
@@ -186,6 +194,9 @@ Below 640px of viewport every size is full width and loses its corners.
186
194
  | closing | `open` turns false | the panel keeps showing the children it had open while it slides out |
187
195
  | busy | `Drawer.Guard busy` | Escape, the scrim, the close button and `Drawer.Close` do nothing; the close button and the `Close` child are `disabled` in place |
188
196
  | dirty | `Drawer.Guard dirty` | a dismiss opens the «Не сохранять изменения?» ConfirmDialog (`labels.discard*`); its confirm closes the drawer |
197
+ | leaving the tab | `Drawer.Guard busy` or `dirty` | the browser asks before the tab closes or reloads (`beforeunload`), as with `Page.Guard` |
198
+ | description loading | `Drawer.Description loading` | a `Skeleton` holds the line, `aria-busy` on the `<p>`; the data fades in under the same element |
199
+ | actions below | the title would get less than 12rem beside `Drawer.Actions` | `data-actions-below` on the header: the actions move under the title and the description |
189
200
 
190
201
  Motion: the scrim fades, the panel slides from its side over `slow` and leaves over `base` (`overlayMotion`); under `prefers-reduced-motion` it unmounts at once. The drawer has no touch gestures: it is not dragged or swiped away — it closes by its buttons, Escape and the scrim, with the same slide-out.
191
202
 
@@ -199,8 +210,10 @@ Motion: the scrim fades, the panel slides from its side over `slow` and leaves o
199
210
  - Full viewport height; only the body scrolls, with its own side padding.
200
211
  - Tabs in the header: a `Tabs.List` inside `Drawer.Header` (with `Tabs.Root` around the header and the body) spans the header's last row. The header becomes the tab strip, edge to edge and without the hairline; the active tab is the body rising into it, the panels sit in the body.
201
212
  - Fields inside get the surface field fill.
202
- - Titled groups of the body (a record's contacts, its deals, its history): `Drawer.Section label` — an `<h3>` under the drawer's `<h2>` title, an optional `description`, a `Drawer.Actions` at the end of its heading row; content 16 below, sections 32 apart. A group of fields is a `Fieldset`; a page section is `Page.Section`.
213
+ - Titled groups of the body (a record's contacts, its deals, its history): `Drawer.Section label` — an `<h3>` under the drawer's `<h2>` title, an optional `description`, a `Drawer.Actions` at the end of its heading row; content 16 below, sections 32 apart — directly in the body, in a `Tabs.Panel` or in a form, with no spacing wrapper of your own. A group of fields is a `Fieldset`; a page section is `Page.Section`.
203
214
  - With a `Drawer.Meta` the buttons stay one row: when the footer runs short the status goes above them first.
215
+ - `Drawer.Actions` keep their place beside the title while it has 12rem; on a phone, where a status and a ⋯ beside the × would fold the title into letters, they move under it by themselves.
216
+ - A record whose data is still loading: the title from the list row, `Drawer.Description loading` and a `Skeleton` body in the data's geometry under a `Crossfade` — not a skeleton of your own in the header.
204
217
 
205
218
  ## Accessibility
206
219
 
@@ -240,8 +253,9 @@ Motion: the scrim fades, the panel slides from its side over `slow` and leaves o
240
253
  | [structure.tsx](examples/structure.tsx) | Optional parts: an icon tile in the header and one full-width action in the footer — `Drawer.Icon`, `Drawer.Footer`, `layout`. |
241
254
  | [sizes.tsx](examples/sizes.tsx) | Every panel width, 360 to 800 px; below 640 px of viewport the panel takes the full width — `size`. |
242
255
  | [placement.tsx](examples/placement.tsx) | The panel slides from the right for details and from the left for filters, rounded only on the edge facing the page — `side`. |
243
- | [header-actions.tsx](examples/header-actions.tsx) | A record card: its status and a ⋯ menu sit in the header before the close button, one tier smaller — `Drawer.Actions`. |
256
+ | [header-actions.tsx](examples/header-actions.tsx) | A record card: its status and a ⋯ menu sit in the header before the close button, one tier smaller; on a phone, where the title has no room beside them, they move under it — `Drawer.Actions`. |
244
257
  | [client-card.tsx](examples/client-card.tsx) | A client card from the list: the contact's avatar heads the panel in place of an icon tile, then the details in titled sections, one with its own action — `Drawer.Icon`, `Avatar.Root`, `Drawer.Section`, `Drawer.Actions`. |
258
+ | [loading.tsx](examples/loading.tsx) | A record card that opens before its data arrives: the title comes from the list row, the line under it and the body hold their place in skeletons, then the data fades in — `Drawer.Description`, `loading`. |
245
259
  | [guard.tsx](examples/guard.tsx) | A form that holds the drawer from inside: after an edit Escape, the scrim and Cancel ask before discarding, the footer says so, and saving locks every way out — `Drawer.Guard`, `Drawer.Meta`. |
246
260
  | [long-content.tsx](examples/long-content.tsx) | A long body scrolls on its own while the header and the footer stay in place — `Drawer.Body`. |
247
261
  | [dismiss.tsx](examples/dismiss.tsx) | An import closes only from its buttons, and not at all while it runs — `closeOnOutsideClick`, `closeOnEscape`. |
@@ -254,6 +268,8 @@ Motion: the scrim fades, the panel slides from its side over `slow` and leaves o
254
268
  - Save or Cancel buttons at the end of the body, or in the header → they go in `Drawer.Footer`, which stays in place while the body scrolls.
255
269
  - A delete confirmation in a Drawer → use ConfirmDialog.
256
270
  - A hand-made heading row (`Typography as="h3"` + buttons) over a group in the body → `Drawer.Section label` with `Drawer.Actions`.
271
+ - A wrapper with its own gap around `Drawer.Section`s inside a `Tabs.Panel` or a form → not needed: sections keep 32 between them in any wrapper.
272
+ - A `Skeleton` placed by hand in `Drawer.Description` while the record loads → `Drawer.Description loading`.
257
273
  - Busy or unsaved state lifted out of the form into Root props → put `Drawer.Guard` next to the form, inside Content.
258
274
  - Clearing the record together with `open` and rendering a skeleton for «no record» → not needed: the panel keeps its last content while it slides out.
259
275
  - A Badge or a menu as a custom child of the header text column → put them in `Drawer.Actions`.
@@ -263,5 +279,5 @@ Motion: the scrim fades, the panel slides from its side over `slow` and leaves o
263
279
  - Padding on a wrapper inside Body → Body already pads and scrolls.
264
280
 
265
281
  ## Related
266
- - **Built from:** the dialog shared with Modal and Sheet (`internal/overlay/DialogParts`), [Button](../button/COMPONENT.md) (close button), [ScrollContainer](../scroll-container/COMPONENT.md) (`Drawer.Body`), [Avatar](../avatar/COMPONENT.md) and [Thumbnail](../thumbnail/COMPONENT.md) (a record's picture in `Drawer.Icon`), [ConfirmDialog](../confirm-dialog/COMPONENT.md) (the `Drawer.Guard` discard confirm), `Icon` (the close glyph)
282
+ - **Built from:** the dialog shared with Modal and Sheet (`internal/overlay/DialogParts`), [Button](../button/COMPONENT.md) (close button), [ScrollContainer](../scroll-container/COMPONENT.md) (`Drawer.Body`), [Avatar](../avatar/COMPONENT.md) and [Thumbnail](../thumbnail/COMPONENT.md) (a record's picture in `Drawer.Icon`), [Skeleton](../skeleton/COMPONENT.md) (`Drawer.Description loading`), [ConfirmDialog](../confirm-dialog/COMPONENT.md) (the `Drawer.Guard` discard confirm), `Icon` (the close glyph)
267
283
  - **See also:** [Modal](../modal/COMPONENT.md) (the same header, body, footer and `Guard` in the centre), [Sheet](../sheet/COMPONENT.md) (the same parts raised from the bottom edge for a short task), [ConfirmDialog](../confirm-dialog/COMPONENT.md) (a destructive confirm), [Sidebar](../../layout/sidebar/COMPONENT.md), [Popover](../popover/COMPONENT.md), [Avatar](../avatar/COMPONENT.md) (a person's picture in `Drawer.Icon`)