@ssa-ui-kit/core 3.26.4 → 3.27.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 (36) hide show
  1. package/dist/ai/source-map.md +100 -37
  2. package/dist/components/Calendar/Calendar.d.ts +11 -3
  3. package/dist/components/Calendar/CalendarContext.d.ts +12 -1
  4. package/dist/components/Calendar/components/CalendarToolbar.d.ts +5 -1
  5. package/dist/components/Calendar/components/DayView.d.ts +4 -2
  6. package/dist/components/Calendar/components/TimeZoneSelect.d.ts +14 -0
  7. package/dist/components/Calendar/consts.d.ts +14 -1
  8. package/dist/components/Calendar/styles.d.ts +37 -1
  9. package/dist/components/Calendar/types.d.ts +93 -5
  10. package/dist/components/Calendar/utils.d.ts +35 -5
  11. package/dist/components/DataTable/DataTable.d.ts +79 -0
  12. package/dist/components/DataTable/DataTableColumnPicker.d.ts +66 -0
  13. package/dist/components/DataTable/ExpanderCell.d.ts +10 -0
  14. package/dist/components/DataTable/SelectionCell.d.ts +25 -0
  15. package/dist/components/DataTable/index.d.ts +4 -0
  16. package/dist/components/DataTable/styles.d.ts +47 -0
  17. package/dist/components/DataTable/types.d.ts +378 -0
  18. package/dist/components/DataTable/useColumnReorder.d.ts +31 -0
  19. package/dist/components/DataTable/useDataTableModel.d.ts +36 -0
  20. package/dist/components/DataTable/utils.d.ts +82 -0
  21. package/dist/components/NestedTable/WithNestedTableRow.d.ts +4 -0
  22. package/dist/components/NestedTable/components/NestedTable.d.ts +4 -0
  23. package/dist/components/NestedTable/components/NestedTableCell.d.ts +4 -0
  24. package/dist/components/NestedTable/components/NestedTableCellHeader.d.ts +4 -0
  25. package/dist/components/NestedTable/components/NestedTableRow.d.ts +4 -0
  26. package/dist/components/Table/ColumnFreezeMenu.d.ts +11 -1
  27. package/dist/components/Table/ColumnMenu.d.ts +30 -0
  28. package/dist/components/Table/Table.d.ts +4 -4
  29. package/dist/components/Table/types.d.ts +77 -6
  30. package/dist/components/TableCellHeader/TableCellHeader.d.ts +1 -1
  31. package/dist/components/TableCellHeader/types.d.ts +14 -5
  32. package/dist/components/index.d.ts +2 -0
  33. package/dist/index.js +2615 -565
  34. package/dist/index.mjs +2615 -566
  35. package/dist/tsbuildcache +1 -1
  36. package/package.json +6 -5
@@ -0,0 +1,82 @@
1
+ import { CSSProperties } from 'react';
2
+ import { DataTableColumn, DataTableColumnState, DataTableElementProps, DataTableSort } from './types';
3
+ /** Width of the checkbox or radio column, in pixels. */
4
+ export declare const SELECTION_COLUMN_WIDTH = 48;
5
+ /** Width of the expand/collapse column, in pixels. */
6
+ export declare const EXPANDER_COLUMN_WIDTH = 36;
7
+ /** Extra left padding of a nested row's first cell, per level. */
8
+ export declare const NESTED_INDENT = 24;
9
+ export declare const EMPTY_COLUMN_STATE: DataTableColumnState;
10
+ /** Fills a partial column state in with defaults. */
11
+ export declare const toColumnState: (value?: Partial<DataTableColumnState>) => DataTableColumnState;
12
+ /**
13
+ * What the TanStack model depends on. Header and cell renderers are left out
14
+ * on purpose: they are read from the latest `columns` at render time, so an
15
+ * inline `columns` array does not rebuild the model on every render.
16
+ */
17
+ export declare const getColumnsSignature: <Row>(columns: DataTableColumn<Row>[]) => string;
18
+ /**
19
+ * The sort after a click on a sortable header: the same column flips
20
+ * direction, another column starts ascending.
21
+ */
22
+ export declare const getNextSort: (current: DataTableSort | null, columnId: string) => DataTableSort;
23
+ /** Whether a click landed on something inside a row with its own behaviour. */
24
+ export declare const isInteractiveTarget: (target: EventTarget | null, row: HTMLElement) => boolean;
25
+ /**
26
+ * Every column id in display order: `order` first, skipping unknown ids, then
27
+ * the rest in the order of `columns`. The same rule TanStack applies.
28
+ */
29
+ export declare const getFullOrder: <Row>(columns: DataTableColumn<Row>[], order: string[]) => string[];
30
+ /** Where a column sits while scrolling: frozen to an edge, or not. */
31
+ export declare const getFreezeZone: (frozen: DataTableColumnState["frozen"], id: string) => "start" | "end" | "scroll";
32
+ /**
33
+ * Moves column `id` to where `targetId` is, shifting the columns between.
34
+ * Only the slots `canMoveTo` accepts take part, so every other column keeps
35
+ * its position. Returns `null` when the target is not one of those slots.
36
+ */
37
+ export declare const moveColumn: (order: string[], id: string, targetId: string, canMoveTo: (id: string) => boolean) => string[] | null;
38
+ /** The nearest slot `canMoveTo` accepts on one side of column `id`. */
39
+ export declare const getAdjacentColumn: (order: string[], id: string, side: "left" | "right", canMoveTo: (id: string) => boolean) => string | null;
40
+ /** How a row's checkbox shows. */
41
+ export type CheckState = 'checked' | 'partial' | 'unchecked';
42
+ /**
43
+ * Cascading selection over a tree of rows. A row with selectable
44
+ * descendants is not selected for itself: it follows the leaves below it,
45
+ * checked when all are, partly when some are. Its id is in the selection
46
+ * exactly when it is checked, so the ids still name every selected row —
47
+ * unless `canSelect` rejects it: its checkbox still selects the rows below,
48
+ * but its own id is never in the selection.
49
+ *
50
+ * Ids not in the tree, such as rows on another page, are left alone.
51
+ */
52
+ export declare const createSelectionTree: (tree: Map<string, {
53
+ parentId?: string;
54
+ childIds: string[];
55
+ }>, canSelect: (id: string) => boolean) => {
56
+ rowState: (id: string, selected: Set<string>) => CheckState;
57
+ /** Whether the row has anything to select, itself or below. */
58
+ isSelectable: (id: string) => boolean;
59
+ allState: (selected: Set<string>) => CheckState;
60
+ toggleRow: (ids: string[], id: string, on: boolean) => string[];
61
+ toggleAll: (ids: string[], on: boolean) => string[];
62
+ };
63
+ /**
64
+ * A row's own `id` field as a row id, when it has a string or number one.
65
+ * What a table without `getRowId` keys its rows by.
66
+ */
67
+ export declare const getOwnRowId: (row: unknown) => string | undefined;
68
+ /**
69
+ * Turns what `getRowProps` returned into props for the row element. The
70
+ * `background` travels as a custom property for the `tintedRow` style, so it
71
+ * reaches the cells, which paint their own background over the row's.
72
+ */
73
+ export declare const toRowElementProps: ({ background, style, ...rest }?: DataTableElementProps) => Omit<DataTableElementProps, "background"> & {
74
+ isTinted: boolean;
75
+ };
76
+ /**
77
+ * Turns what a column's `getCellProps` returned into props for the cell
78
+ * element. The table's own style, the nested indent, wins over the column's,
79
+ * so a cell style cannot flatten the tree. The `background` is inline, so it
80
+ * outlasts the row's hover and selected states.
81
+ */
82
+ export declare const toCellElementProps: ({ background, style, ...rest }?: DataTableElementProps, ownStyle?: CSSProperties) => Omit<DataTableElementProps, "background">;
@@ -12,6 +12,10 @@ import { WithNestedTableRowProps } from './types';
12
12
  * and ignores `defaultCollapsed` — otherwise it could start collapsed with no
13
13
  * way to reopen it.
14
14
  *
15
+ * @deprecated Use `DataTable` with `getSubRows` instead: it nests rows from
16
+ * data, to any depth, with accessible expand buttons. `NestedTable` is
17
+ * removed in the next major release.
18
+ *
15
19
  * @category Components
16
20
  * @subcategory Data Display
17
21
  *
@@ -39,6 +39,10 @@ import { TableProps } from '../../Table/types';
39
39
  * opaque one — a translucent row would let scrolled content show through.
40
40
  * With resizing on, the table renders its own `colgroup`; drop any you had.
41
41
  *
42
+ * @deprecated Use `DataTable` with `getSubRows` instead: it nests rows from
43
+ * data, to any depth, with accessible expand buttons. `NestedTable` is
44
+ * removed in the next major release.
45
+ *
42
46
  * @category Components
43
47
  * @subcategory Data Display
44
48
  *
@@ -15,6 +15,10 @@ import { NestedTableCellBaseProps } from './NestedTableCellBase';
15
15
  * Borders and background are cleared so the group reads as one block; the row
16
16
  * supplies the shading.
17
17
  *
18
+ * @deprecated Use `DataTable` with `getSubRows` instead: it nests rows from
19
+ * data, to any depth, with accessible expand buttons. `NestedTable` is
20
+ * removed in the next major release.
21
+ *
18
22
  * @category Components
19
23
  * @subcategory Data Display
20
24
  *
@@ -12,6 +12,10 @@ import { NestedTableCellHeaderProps } from '../types';
12
12
  * toggle column the row adds in front gets no handle or menu, and does not
13
13
  * count as a column — `0` is the first header cell you render.
14
14
  *
15
+ * @deprecated Use `DataTable` with `getSubRows` instead: it nests rows from
16
+ * data, to any depth, with accessible expand buttons. `NestedTable` is
17
+ * removed in the next major release.
18
+ *
15
19
  * @category Components
16
20
  * @subcategory Data Display
17
21
  *
@@ -17,6 +17,10 @@ import { HTMLAttributes } from 'react';
17
17
  * it collapses or expands the rest of the group. Later rows are the collapsible
18
18
  * body. A group holding only one row shows no toggle and never collapses.
19
19
  *
20
+ * @deprecated Use `DataTable` with `getSubRows` instead: it nests rows from
21
+ * data, to any depth, with accessible expand buttons. `NestedTable` is
22
+ * removed in the next major release.
23
+ *
20
24
  * @category Components
21
25
  * @subcategory Data Display
22
26
  *
@@ -1,4 +1,14 @@
1
- import { ColumnFreezeMenuProps } from './types';
1
+ import { ColumnFreezeMenuProps, ColumnId, FrozenColumns } from './types';
2
+ /** Which edge a column is frozen to, if any. */
3
+ export declare const getFrozenEdge: ({ start, end }: Required<FrozenColumns>, id: ColumnId) => "start" | "end" | null;
4
+ /**
5
+ * The freeze actions for one column's header menu, each with the frozen
6
+ * columns it leads to. Shared by `ColumnFreezeMenu` and `DataTable`.
7
+ */
8
+ export declare const getFreezeMenuItems: (frozen: Required<FrozenColumns>, id: ColumnId) => {
9
+ label: string;
10
+ next: Required<FrozenColumns>;
11
+ }[];
2
12
  /**
3
13
  * ColumnFreezeMenu - The freeze/unfreeze menu in a table header cell
4
14
  *
@@ -0,0 +1,30 @@
1
+ import { Ref } from 'react';
2
+ /** Where a column menu sits in its header cell. */
3
+ export declare const ColumnMenuAnchor: import("@emotion/styled").StyledComponent<{
4
+ theme?: import("@emotion/react").Theme;
5
+ as?: React.ElementType;
6
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
7
+ /** One action of a {@link ColumnMenu}. */
8
+ export interface ColumnMenuItem {
9
+ label: string;
10
+ onSelect: () => void;
11
+ disabled?: boolean;
12
+ }
13
+ interface ColumnMenuProps {
14
+ items: ColumnMenuItem[];
15
+ /** Accessible name of the menu. */
16
+ label: string;
17
+ /** Accessible name of the trigger button. */
18
+ triggerLabel: string;
19
+ /** Shows the lock icon, and keeps the trigger visible. */
20
+ frozen?: boolean;
21
+ ref?: Ref<HTMLSpanElement>;
22
+ className?: string;
23
+ }
24
+ /**
25
+ * The menu button of a table header cell: a trigger that shows on hover and
26
+ * opens a list of actions. `ColumnFreezeMenu` and `DataTable`'s column menu
27
+ * are both built on it.
28
+ */
29
+ export declare const ColumnMenu: ({ items, label, triggerLabel, frozen, ref, className, }: ColumnMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
30
+ export {};
@@ -23,10 +23,10 @@ import { TableProps } from './types';
23
23
  * it would have had anyway, then switches to `table-layout: fixed` and
24
24
  * truncates overflowing cell content with an ellipsis.
25
25
  *
26
- * By default a resize is a trade between two columns: the one to the right
27
- * gives up exactly what the dragged column gains, so the table stays the width
28
- * it was and nothing around it reflows. The last column has nothing to its
29
- * right to trade with, so it has no handle.
26
+ * By default a resize is paid for by the columns to the right: they give up
27
+ * what the dragged column gains, each in proportion to its width, so the table
28
+ * stays the width it was and nothing around it reflows. The last column has
29
+ * nothing to its right to trade with, so it has no handle.
30
30
  *
31
31
  * `columnResizeMode="expand"` opts into the other model — the table grows
32
32
  * with the dragged column and the others keep their widths — for tables that
@@ -3,9 +3,10 @@ import { CommonProps } from '../../types/emotion';
3
3
  /**
4
4
  * How a resize distributes width.
5
5
  *
6
- * - `fit` — the column to the right gives up what the dragged column gains, so
7
- * the table's own width never changes. The last column cannot be dragged,
8
- * having nothing to its right to trade with.
6
+ * - `fit` — the resizable columns to the right share out what the dragged
7
+ * column gains or gives up, each in proportion to its width, so the table's
8
+ * own width never changes. The last column cannot be dragged, having nothing
9
+ * to its right to trade with.
9
10
  * - `expand` — the table grows and the other columns keep their widths, so the
10
11
  * table needs a horizontally scrollable parent.
11
12
  */
@@ -41,8 +42,8 @@ export interface ColumnResizeOptions {
41
42
  */
42
43
  maxColumnWidth?: number;
43
44
  /**
44
- * Whether a resize is paid for by the next column or by the table's own
45
- * width. Defaults to `fit`, which keeps the table exactly as wide as it was
45
+ * Whether a resize is paid for by the columns to the right or by the
46
+ * table's own width. Defaults to `fit`, which keeps the table exactly as wide as it was
46
47
  * — surrounding layout never moves because a user dragged a column.
47
48
  *
48
49
  * Switch to `expand` when the table lives in its own scroll container and
@@ -218,7 +219,9 @@ export interface ColumnFreezeApi {
218
219
  * Props for the {@link Table} component.
219
220
  *
220
221
  * Every attribute of a `table` element, plus the column-resizing options that
221
- * `resizableColumns` turns on and the column-freezing options.
222
+ * `resizableColumns` turns on and the column-freezing options. The column
223
+ * options are deprecated: for tables with column features, use `DataTable`,
224
+ * which keeps them by column id.
222
225
  *
223
226
  * @example
224
227
  * ```tsx
@@ -239,6 +242,74 @@ export interface TableProps extends CommonProps, ColumnResizeOptions, ColumnFree
239
242
  * `columnResizeMode`.
240
243
  *
241
244
  * @default false
245
+ * @deprecated Use `DataTable`'s `resizableColumns` instead: it keeps
246
+ * widths by column id. Removed from `Table` in the next major release.
242
247
  */
243
248
  resizableColumns?: boolean;
249
+ /**
250
+ * Column widths in pixels, one per column, for the controlled case.
251
+ *
252
+ * @deprecated Use `DataTable`'s `columnState.widths`, keyed by column id instead. Removed from `Table` in the next major release.
253
+ */
254
+ columnWidths?: number[];
255
+ /**
256
+ * Starting column widths in pixels, for the uncontrolled case.
257
+ *
258
+ * @deprecated Use `DataTable`'s `defaultColumnState.widths` instead. Removed from `Table` in the next major release.
259
+ */
260
+ defaultColumnWidths?: number[];
261
+ /**
262
+ * Called on every width change, including each frame of a drag.
263
+ *
264
+ * @deprecated Use `DataTable`'s `onColumnStateChange` instead. Removed from `Table` in the next major release.
265
+ */
266
+ onColumnWidthsChange?: (columnWidths: number[]) => void;
267
+ /**
268
+ * Narrowest a column can be dragged, in pixels.
269
+ *
270
+ * @deprecated Use `DataTable`'s `minColumnWidth` instead. Removed from `Table` in the next major release.
271
+ */
272
+ minColumnWidth?: number;
273
+ /**
274
+ * Widest a column can be dragged, in pixels.
275
+ *
276
+ * @deprecated Use `DataTable`'s `maxColumnWidth` instead. Removed from `Table` in the next major release.
277
+ */
278
+ maxColumnWidth?: number;
279
+ /**
280
+ * Whether a resize is paid for by the columns to the right or by the table's own width.
281
+ *
282
+ * @deprecated Use `DataTable`'s `columnResizeMode` instead. Removed from `Table` in the next major release.
283
+ */
284
+ columnResizeMode?: ColumnResizeMode;
285
+ /**
286
+ * Columns frozen to each edge, for the controlled case.
287
+ *
288
+ * @deprecated Use `DataTable`'s `columnState.frozen` instead. Removed from `Table` in the next major release.
289
+ */
290
+ frozenColumns?: FrozenColumns;
291
+ /**
292
+ * Columns frozen to each edge to begin with.
293
+ *
294
+ * @deprecated Use `DataTable`'s `defaultColumnState.frozen` instead. Removed from `Table` in the next major release.
295
+ */
296
+ defaultFrozenColumns?: FrozenColumns;
297
+ /**
298
+ * Called whenever the user freezes or unfreezes columns.
299
+ *
300
+ * @deprecated Use `DataTable`'s `onColumnStateChange` instead. Removed from `Table` in the next major release.
301
+ */
302
+ onFrozenColumnsChange?: (frozenColumns: Required<FrozenColumns>) => void;
303
+ /**
304
+ * Gives every `TableCellHeader` a menu to freeze its column.
305
+ *
306
+ * @deprecated Use `DataTable`'s `freezeControls` instead. Removed from `Table` in the next major release.
307
+ */
308
+ freezeControls?: boolean;
309
+ /**
310
+ * Keeps the header row in view while the table scrolls vertically.
311
+ *
312
+ * @deprecated Use `DataTable`'s `stickyHeader` with `maxHeight` instead. Removed from `Table` in the next major release.
313
+ */
314
+ stickyHeader?: boolean;
244
315
  }
@@ -62,5 +62,5 @@ import { TableCellHeaderProps } from './types';
62
62
  * - Supports ARIA attributes via TableCellProps
63
63
  * - Better accessibility than using TableCell in headers
64
64
  */
65
- declare const TableCellHeader: ({ children, resizable, freezable, columnId, ...props }: React.PropsWithChildren<TableCellHeaderProps>) => import("@emotion/react/jsx-runtime").JSX.Element;
65
+ declare const TableCellHeader: ({ children, resizable, freezable, columnId, minWidth, maxWidth, ...props }: React.PropsWithChildren<TableCellHeaderProps>) => import("@emotion/react/jsx-runtime").JSX.Element;
66
66
  export default TableCellHeader;
@@ -32,11 +32,10 @@ export interface TableCellHeaderProps extends TableCellProps {
32
32
  * `resizableColumns`. Set it to `false` to pin a column — an actions or
33
33
  * checkbox column, typically — at a width the user cannot change.
34
34
  *
35
- * In the default `fit` mode this also removes the handle from the column to
36
- * its *left*, because that handle resizes by trading width with this one and
37
- * would otherwise move a column the user was told they could not move. In
38
- * `expand` mode nothing pays for a resize, so only this column's own handle
39
- * goes.
35
+ * In the default `fit` mode this column also keeps its width when a column
36
+ * to its left is resized: the other columns to the right absorb the change,
37
+ * and a handle with no such column left is hidden. In `expand` mode nothing
38
+ * pays for a resize, so only this column's own handle goes.
40
39
  *
41
40
  * Ignored outside a resizable table.
42
41
  *
@@ -52,6 +51,16 @@ export interface TableCellHeaderProps extends TableCellProps {
52
51
  * @default true
53
52
  */
54
53
  freezable?: boolean;
54
+ /**
55
+ * Narrowest this column can be resized to, in pixels, inside a `Table` with
56
+ * `resizableColumns`. Overrides the table's `minColumnWidth`.
57
+ */
58
+ minWidth?: number;
59
+ /**
60
+ * Widest this column can be resized to, in pixels, inside a `Table` with
61
+ * `resizableColumns`. Overrides the table's `maxColumnWidth`.
62
+ */
63
+ maxWidth?: number;
55
64
  /**
56
65
  * Stable id for this column, used by `frozenColumns` on the `Table`. Give
57
66
  * every header one when the app can hide or reorder columns, so frozen
@@ -62,6 +62,8 @@ export { default as FormRadioGroup } from './FormRadioGroup';
62
62
  export * from './Filters';
63
63
  export * from './FiltersMultiSelect';
64
64
  export * as JsonSchema from './JsonSchemaForm';
65
+ export { default as DataTable, DataTableColumnPicker } from './DataTable';
66
+ export type { DataTableColumn, DataTableColumnPickerProps, DataTableColumnState, DataTableElementProps, DataTableProps, DataTableSelectionMode, DataTableSort, DataTableSortDirection, } from './DataTable';
65
67
  export { default as Table } from './Table';
66
68
  export { ColumnFreezeMenu, ColumnResizeHandle, useColumnFreezeContext, useColumnResize, useColumnResizeContext, } from './Table';
67
69
  export type { ColumnFreezeApi, ColumnFreezeMenuProps, ColumnFreezeOptions, ColumnId, ColumnResizeApi, ColumnResizeHandleProps, ColumnResizeMode, ColumnResizeOptions, FrozenColumns, ResizeHandleProps, TableProps, UseColumnResizeOptions, } from './Table';