prime-ui-kit 0.18.0 → 0.20.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 (145) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{chunk-OAXJWF3L.js → chunk-3PY52JP3.js} +1764 -1764
  3. package/dist/chunks/{chunk-X3JT5CLR.js → chunk-4KONMO7Z.js} +1 -1
  4. package/dist/chunks/{chunk-MB4CXSLL.js → chunk-W6EGTNG6.js} +3772 -2888
  5. package/dist/color-picker.js +2 -2
  6. package/dist/components/data-table/ColumnsMenu.d.ts +39 -17
  7. package/dist/components/data-table/DataTable.d.ts +41 -12
  8. package/dist/components/data-table/DataTableColumnsMenu.d.ts +45 -0
  9. package/dist/components/data-table/Head.d.ts +18 -5
  10. package/dist/components/data-table/Row.d.ts +10 -4
  11. package/dist/components/data-table/StateRows.d.ts +5 -3
  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 +37 -15
  22. package/dist/components/gantt/Gantt.d.ts +1 -1
  23. package/dist/components/index.d.ts +3 -1
  24. package/dist/components/kanban/Kanban.d.ts +4 -0
  25. package/dist/components/list/List.d.ts +9 -4
  26. package/dist/components/scroll-container/ScrollContainer.d.ts +1 -1
  27. package/dist/index.css +1 -1
  28. package/dist/index.js +4 -2
  29. package/dist/internal/ToolRow.d.ts +23 -0
  30. package/dist/internal/leaveGuard.d.ts +6 -0
  31. package/dist/internal/overlay/DialogGuard.d.ts +3 -2
  32. package/dist/internal/overlay/DialogParts.d.ts +14 -5
  33. package/dist/layout/index.d.ts +1 -1
  34. package/dist/layout/page/Page.d.ts +8 -14
  35. package/dist/skill/anti-slop.md +55 -1
  36. package/dist/skill/api-contract.md +2 -2
  37. package/dist/skill/cheatsheet.md +12 -4
  38. package/dist/skill/checklist.md +7 -0
  39. package/dist/skill/choosing.md +1 -0
  40. package/dist/skill/components.md +1 -1
  41. package/dist/skill/composition.md +196 -21
  42. package/dist/skill/layouts.md +1 -1
  43. package/dist/skill/reference/components/confirm-dialog/COMPONENT.md +1 -1
  44. package/dist/skill/reference/components/data-table/COMPONENT.md +110 -49
  45. package/dist/skill/reference/components/data-table/examples/actions-column.tsx +154 -0
  46. package/dist/skill/reference/components/data-table/examples/column-order.tsx +152 -0
  47. package/dist/skill/reference/components/data-table/examples/columns-visibility.tsx +18 -18
  48. package/dist/skill/reference/components/data-table/examples/controlled.tsx +32 -17
  49. package/dist/skill/reference/components/data-table/examples/examples.module.css +14 -36
  50. package/dist/skill/reference/components/data-table/examples/narrow.tsx +25 -19
  51. package/dist/skill/reference/components/data-table/examples/reorder.tsx +24 -2
  52. package/dist/skill/reference/components/data-table/examples/row-link.tsx +18 -22
  53. package/dist/skill/reference/components/data-table/examples/screen.tsx +12 -1
  54. package/dist/skill/reference/components/data-table/examples/selection.tsx +13 -18
  55. package/dist/skill/reference/components/data-table/examples/server.tsx +45 -31
  56. package/dist/skill/reference/components/data-table/examples/toolbar.tsx +22 -35
  57. package/dist/skill/reference/components/datepicker/COMPONENT.md +2 -2
  58. package/dist/skill/reference/components/dnd/COMPONENT.md +13 -7
  59. package/dist/skill/reference/components/dnd/examples/examples.module.css +4 -3
  60. package/dist/skill/reference/components/dnd/examples/handle.tsx +5 -5
  61. package/dist/skill/reference/components/dnd/examples/locked.tsx +1 -1
  62. package/dist/skill/reference/components/dnd/examples/table-columns.tsx +75 -0
  63. package/dist/skill/reference/components/dnd/examples/table.tsx +6 -6
  64. package/dist/skill/reference/components/drawer/COMPONENT.md +26 -10
  65. package/dist/skill/reference/components/drawer/examples/header-actions.tsx +1 -1
  66. package/dist/skill/reference/components/drawer/examples/loading.tsx +58 -0
  67. package/dist/skill/reference/components/field-list/COMPONENT.md +78 -47
  68. package/dist/skill/reference/components/field-list/examples/base-row.tsx +2 -1
  69. package/dist/skill/reference/components/field-list/examples/locked.tsx +11 -11
  70. package/dist/skill/reference/components/field-list/examples/narrow.tsx +108 -33
  71. package/dist/skill/reference/components/field-list/examples/reorder.tsx +1 -1
  72. package/dist/skill/reference/components/field-list/examples/row-menu.tsx +71 -0
  73. package/dist/skill/reference/components/field-list/examples/screen.module.css +1 -1
  74. package/dist/skill/reference/components/field-list/examples/screen.tsx +169 -162
  75. package/dist/skill/reference/components/field-list/examples/totals.tsx +9 -8
  76. package/dist/skill/reference/components/field-list/examples/variants.tsx +51 -0
  77. package/dist/skill/reference/components/gantt/COMPONENT.md +4 -4
  78. package/dist/skill/reference/components/kanban/COMPONENT.md +6 -2
  79. package/dist/skill/reference/components/kanban/examples/states.tsx +7 -5
  80. package/dist/skill/reference/components/list/COMPONENT.md +21 -11
  81. package/dist/skill/reference/components/list/examples/reorder.tsx +42 -7
  82. package/dist/skill/reference/components/modal/COMPONENT.md +23 -10
  83. package/dist/skill/reference/components/scroll-container/COMPONENT.md +1 -1
  84. package/dist/skill/reference/components/segmented-control/COMPONENT.md +3 -2
  85. package/dist/skill/reference/components/sheet/COMPONENT.md +18 -7
  86. package/dist/skill/reference/components/smart-filter/COMPONENT.md +2 -2
  87. package/dist/skill/reference/layout/page/COMPONENT.md +13 -17
  88. package/dist/skill/reference/layout/page/examples/screen.module.css +1 -1
  89. package/dist/skill/reference/layout/page/examples/screen.tsx +93 -104
  90. package/dist/skill/reference/layout/page/examples/sections.tsx +2 -15
  91. package/dist/skill/responsive.md +14 -10
  92. package/dist/tokens/semantic.d.ts +2 -2
  93. package/dist/tokens/themes/dark.d.ts +1 -1
  94. package/package.json +1 -1
  95. package/src/components/confirm-dialog/COMPONENT.md +1 -1
  96. package/src/components/data-table/COMPONENT.md +110 -49
  97. package/src/components/data-table/examples/actions-column.tsx +154 -0
  98. package/src/components/data-table/examples/column-order.tsx +152 -0
  99. package/src/components/data-table/examples/columns-visibility.tsx +18 -18
  100. package/src/components/data-table/examples/controlled.tsx +32 -17
  101. package/src/components/data-table/examples/examples.module.css +14 -36
  102. package/src/components/data-table/examples/narrow.tsx +25 -19
  103. package/src/components/data-table/examples/reorder.tsx +24 -2
  104. package/src/components/data-table/examples/row-link.tsx +18 -22
  105. package/src/components/data-table/examples/screen.tsx +12 -1
  106. package/src/components/data-table/examples/selection.tsx +13 -18
  107. package/src/components/data-table/examples/server.tsx +45 -31
  108. package/src/components/data-table/examples/toolbar.tsx +22 -35
  109. package/src/components/datepicker/COMPONENT.md +2 -2
  110. package/src/components/dnd/COMPONENT.md +13 -7
  111. package/src/components/dnd/examples/examples.module.css +4 -3
  112. package/src/components/dnd/examples/handle.tsx +5 -5
  113. package/src/components/dnd/examples/locked.tsx +1 -1
  114. package/src/components/dnd/examples/table-columns.tsx +75 -0
  115. package/src/components/dnd/examples/table.tsx +6 -6
  116. package/src/components/drawer/COMPONENT.md +26 -10
  117. package/src/components/drawer/examples/header-actions.tsx +1 -1
  118. package/src/components/drawer/examples/loading.tsx +58 -0
  119. package/src/components/field-list/COMPONENT.md +78 -47
  120. package/src/components/field-list/examples/base-row.tsx +2 -1
  121. package/src/components/field-list/examples/locked.tsx +11 -11
  122. package/src/components/field-list/examples/narrow.tsx +108 -33
  123. package/src/components/field-list/examples/reorder.tsx +1 -1
  124. package/src/components/field-list/examples/row-menu.tsx +71 -0
  125. package/src/components/field-list/examples/screen.module.css +1 -1
  126. package/src/components/field-list/examples/screen.tsx +169 -162
  127. package/src/components/field-list/examples/totals.tsx +9 -8
  128. package/src/components/field-list/examples/variants.tsx +51 -0
  129. package/src/components/gantt/COMPONENT.md +4 -4
  130. package/src/components/kanban/COMPONENT.md +6 -2
  131. package/src/components/kanban/examples/states.tsx +7 -5
  132. package/src/components/list/COMPONENT.md +21 -11
  133. package/src/components/list/examples/reorder.tsx +42 -7
  134. package/src/components/modal/COMPONENT.md +23 -10
  135. package/src/components/scroll-container/COMPONENT.md +1 -1
  136. package/src/components/segmented-control/COMPONENT.md +3 -2
  137. package/src/components/sheet/COMPONENT.md +18 -7
  138. package/src/components/smart-filter/COMPONENT.md +2 -2
  139. package/src/layout/page/COMPONENT.md +13 -17
  140. package/src/layout/page/examples/screen.module.css +1 -1
  141. package/src/layout/page/examples/screen.tsx +93 -104
  142. package/src/layout/page/examples/sections.tsx +2 -15
  143. package/src/styles/theme-dark.css +1 -1
  144. package/src/styles/theme-light.css +1 -1
  145. package/dist/components/data-table/context.d.ts +0 -14
@@ -5,14 +5,24 @@ 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
- /** Spoken name of the lock on a `getLocked` row of a list without `reorderable`. */
15
- locked: string;
24
+ /** Why a pinned row cannot be removed: the tooltip of its remove button, the note in its menu. */
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;
18
28
  /** Name of the totals row (`renderTotals`), shown in its first cell when that has no total. */
@@ -25,8 +35,8 @@ export type FieldListColumn = {
25
35
  /** Column heading, shown once above the rows; it names the field of this column in every row. */
26
36
  label: string;
27
37
  /**
28
- * `fill` (default) shares the free width; `compact` fits an icon-only control (an icon Select,
29
- * a swatch button, a checkbox); `xs` a number of a few digits (a share, a percent); `s` a short
38
+ * `fill` (default) shares the free width; `compact` is as wide as its widest control or heading
39
+ * (an icon Select, a swatch button, a checkbox); `xs` a number of a few digits (a share, a percent); `s` a short
30
40
  * value (a quantity, a code); `m` an amount or a date.
31
41
  */
32
42
  width?: FieldListColumnWidth;
@@ -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).
@@ -68,7 +82,7 @@ export type FieldListProps<T extends object> = Omit<FieldRootDomProps, "onChange
68
82
  */
69
83
  renderItem: (item: T, row: FieldListRow<T>) => React.ReactNode;
70
84
  /**
71
- * The totals row under the rows: one node per column (a fragment), `null` where a column has none. The first cell without a total reads `labels.totals`, the row's group name.
85
+ * The totals row under the rows: one node per column (a fragment), `null` where none; each aligned as its column's field text. The first cell without a total reads `labels.totals`.
72
86
  */
73
87
  renderTotals?: (items: readonly T[]) => React.ReactNode;
74
88
  /**
@@ -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: a lock in the lead column, no remove button, they hold their place 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 leading handle: 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
  /**
@@ -40,8 +40,10 @@ export type { ConfirmDialogLabels, ConfirmDialogRootProps, ConfirmDialogTriggerP
40
40
  export { ConfirmDialog } from "./confirm-dialog/ConfirmDialog";
41
41
  export type { CrossfadeProps } from "./crossfade/Crossfade";
42
42
  export { Crossfade } from "./crossfade/Crossfade";
43
- export type { DataTableColumn, DataTableColumnsMenuProps, DataTableGroup, DataTableLabels, DataTableOrder, DataTableProps, DataTableRowClickEvent, DataTableSortState, } from "./data-table/DataTable";
43
+ export type { DataTableColumn, DataTableGroup, DataTableLabels, DataTableOrder, DataTableProps, DataTableRowClickEvent, DataTableSortState, } from "./data-table/DataTable";
44
44
  export { DataTable } from "./data-table/DataTable";
45
+ export type { DataTableColumnsMenuLabels, DataTableColumnsMenuProps, } from "./data-table/DataTableColumnsMenu";
46
+ export { DataTableColumnsMenu } from "./data-table/DataTableColumnsMenu";
45
47
  export type { DatepickerLabels, DatepickerPanelProps, DatepickerPreset, DatepickerRange, DatepickerRootProps, WeekStart, } from "./datepicker/Datepicker";
46
48
  export { Datepicker, DEFAULT_DATEPICKER_PRESETS, datepickerPresets, formatDatepickerValue, formatDateValue, YEARLESS_YEAR, } from "./datepicker/Datepicker";
47
49
  export type { DescriptionListItemActionProps, DescriptionListItemProps, DescriptionListLabels, DescriptionListOrientation, DescriptionListRootProps, } from "./description-list/DescriptionList";
@@ -141,6 +141,10 @@ export type KanbanRootProps<T> = Omit<React.HTMLAttributes<HTMLDivElement>, "chi
141
141
  * Columns show skeleton cards in the card geometry; the cards cross-fade in when it turns off.
142
142
  */
143
143
  loading?: boolean;
144
+ /**
145
+ * Placeholder columns a `loading` board draws while `columns` is empty (the stages are still loading); the columns fade in where they stood.
146
+ */
147
+ loadingColumns?: number;
144
148
  /**
145
149
  * Read-only board: no drag, no keyboard moves, no column grips; `onItemOpen` and `getItemHref` still open cards.
146
150
  */
@@ -11,7 +11,7 @@ export type ListRootProps = Omit<React.HTMLAttributes<HTMLUListElement>, "childr
11
11
  */
12
12
  size?: ControlSize;
13
13
  /**
14
- * Rows reorder by a leading handle (drag, touch hold, Alt + ↑ / ↓): item `value` `id` goes before `beforeId` (`null` = last). Apply with `moveBefore`; a returned promise keeps the row busy, a rejection moves it back.
14
+ * Rows reorder by an end handle (drag, touch hold, Alt + ↑ / ↓): item `value` `id` goes before `beforeId` (`null` = last). Apply with `moveBefore`; a returned promise keeps the row busy, a rejection moves it back.
15
15
  */
16
16
  onReorder?: (id: string, beforeId: string | null) => void | Promise<void>;
17
17
  /**
@@ -90,14 +90,19 @@ declare namespace ListItemCount {
90
90
  var displayName: string;
91
91
  }
92
92
  export type ListItemActionsProps = React.HTMLAttributes<HTMLDivElement> & {
93
+ /**
94
+ * `"end"` after the row element: a plain settings row, label first. `"start"` before it, in the DOM too: the on / off of a reorderable row reads first and the grip keeps the end.
95
+ */
96
+ side?: "start" | "end";
93
97
  ref?: React.Ref<HTMLDivElement>;
94
98
  };
95
99
  /**
96
- * The row's own controls (a Switch, a Dropdown with its icon Button, an icon Button): at the end of
97
- * the row, beside its button or link and never inside it, one tier below the row. The row's fills
100
+ * The row's own controls (a Switch, a Dropdown with its icon Button, an icon Button): beside its
101
+ * button or link and never inside it, one tier below the row — at its end, or leading it with
102
+ * `side="start"` (the on / off of a reorderable row, whose end edge is the grip's). The row's fills
98
103
  * cover them.
99
104
  */
100
- declare function ListItemActions({ className, ...rest }: ListItemActionsProps): import("react/jsx-runtime").JSX.Element;
105
+ declare function ListItemActions({ side, className, ...rest }: ListItemActionsProps): import("react/jsx-runtime").JSX.Element;
101
106
  declare namespace ListItemActions {
102
107
  var displayName: string;
103
108
  }
@@ -17,7 +17,7 @@ export type ScrollContainerProps = React.HTMLAttributes<HTMLElement> & {
17
17
  */
18
18
  axis?: ScrollContainerAxis;
19
19
  /**
20
- * CSS `overscroll-behavior`; `contain` stops scroll chaining into the page.
20
+ * CSS `overscroll-behavior` along the region's own axes; `contain` stops scroll chaining into the page, a scroll across them still reaches the region around.
21
21
  */
22
22
  overscrollBehavior?: "auto" | "contain" | "none";
23
23
  /**