asma-ui-core 3.131.0 → 3.132.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.
@@ -1,4 +1,4 @@
1
- import { Table } from '@tanstack/react-table';
1
+ import { ColumnOrderState, Table, VisibilityState } from '@tanstack/react-table';
2
2
  /**
3
3
  * The leaf column ids of the table's current column definitions, in definition order (group columns
4
4
  * flattened). Read live on every call: the column definitions may change while the table stays mounted, so
@@ -7,15 +7,48 @@ import { Table } from '@tanstack/react-table';
7
7
  export declare const getDefinitionColumnOrder: <TData>(table: Table<TData>) => string[];
8
8
  /** The leaf column ids as the table shows them now, with the saved column order applied. */
9
9
  export declare const getEffectiveColumnOrder: <TData>(table: Table<TData>) => string[];
10
+ /**
11
+ * The order the table shows for a `columnOrder` state, the way TanStack applies it: the listed columns that exist, in the
12
+ * listed order, then every other column in definition order. `[]` is the definition order.
13
+ */
14
+ export declare const effectiveColumnOrder: (order: ColumnOrderState, definitionIds: readonly string[]) => string[];
15
+ /**
16
+ * ASMA-8695, DEC-03: puts every column that a saved order does not list at its definition position, not at the end, which is
17
+ * where TanStack puts it. Each missing column goes right after the closest column before it in the definition that the order
18
+ * lists; with none before it, right before the closest one after it; with none at all, at the end. Ids that no column has are
19
+ * kept, so an order saved for columns that are not there at the moment survives (ASMA-8597, DEC-W).
20
+ */
21
+ export declare const insertMissingColumns: (order: readonly string[], definitionIds: readonly string[]) => string[];
22
+ /**
23
+ * The order a table with `persistColumnLayout` opens with when the user has saved none: its `initialState.columnOrder`, with
24
+ * the columns that list does not name at their definition position (DEC-03), as in a saved order; `[]` stays `[]`, the
25
+ * definition order. Used for every comparison with "the default" (the dot, the storage rule, Reset), so the same list is the
26
+ * default everywhere (ASMA-8695, audit round 2).
27
+ */
28
+ export declare const normalizeDefaultColumnOrder: (order: ColumnOrderState, definitionIds: readonly string[]) => string[];
29
+ /**
30
+ * What a `columnVisibility` state changes from the defaults: only the columns whose visibility differs, never an internal
31
+ * column (the select column is hidden unless the app shows it, and is not the user's to change). This is what a table saves
32
+ * (ASMA-8695, DEC-02), and a state with no difference is the default.
33
+ */
34
+ export declare const diffColumnVisibility: (state: VisibilityState, defaults: VisibilityState) => Record<string, boolean>;
35
+ /** Same differences in any key order count as the same visibility. */
36
+ export declare const columnVisibilitySignature: (state: VisibilityState, defaults: VisibilityState) => string;
10
37
  /** `true` when no column has been moved away from its definition position. */
11
38
  export declare const isDefaultColumnOrder: <TData>(table: Table<TData>) => boolean;
12
39
  /**
13
40
  * `true` when the user has moved a column the popover lists. It compares the popover's columns in their
14
- * effective order with the same columns in definition order, so a stored order that matches the current
15
- * definitions shows nothing, and a column that disappeared from `columns` does not count as a move.
41
+ * effective order with the same columns in the default order, so a stored order that matches the current
42
+ * definitions shows nothing, and a column that disappeared from `columns` does not count as a move. The default order is the
43
+ * definition order, or on a table with `persistColumnLayout` the one its `initialState.columnOrder` declares (ASMA-8695).
16
44
  */
17
45
  export declare const hasReorderedColumns: <TData>(table: Table<TData>) => boolean;
18
- /** `true` when a column the user may hide is hidden. Internal columns and columns fixed visible don't count. */
46
+ /**
47
+ * `true` when the user's visibility is not the default. A table with `persistColumnLayout` knows its defaults, so a column
48
+ * hidden by default is no change, while showing it, or hiding a column that is shown by default, is (ASMA-8695, Q10,
49
+ * DEC-05). Any other table has no known defaults, so a hidden column the user may hide is the change, as before. Internal
50
+ * columns and columns fixed visible never count.
51
+ */
19
52
  export declare const hasHiddenColumns: <TData>(table: Table<TData>) => boolean;
20
53
  /**
21
54
  * Whether the user's column layout differs from the table's defaults: a hidden column or a moved one. This
@@ -1,16 +1,36 @@
1
- import { ColumnOrderState, OnChangeFn } from '@tanstack/react-table';
1
+ import { ColumnOrderState, OnChangeFn, VisibilityState } from '@tanstack/react-table';
2
2
  export interface OrderedColumnsTableState {
3
3
  columnOrder: ColumnOrderState;
4
4
  }
5
5
  export interface OrderedColumnsOptions {
6
6
  onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
7
+ /**
8
+ * Saves the column order under this key, unscoped: every user of a browser shares it, so give it only to a table that
9
+ * has no per-user option. A table with `persistColumnLayout` (ASMA-8695) saves the order under its own `uniqueKey`
10
+ * instead, and reads this key once, as the old entry to migrate, and then deletes it.
11
+ */
7
12
  persistColumnOrderKey?: string;
8
13
  }
14
+ /** The layout a table opens with when it has no saved one: what the app's `initialState` declares (ASMA-8695). */
15
+ export interface ColumnLayoutDefaults {
16
+ /** `initialState.columnOrder`; `[]` is the definition order. */
17
+ order: ColumnOrderState;
18
+ /** The whole visibility state a table opens with, internal columns included; a column it does not list is visible. */
19
+ visibility: VisibilityState;
20
+ }
9
21
  export interface ColumnSettingsInstance {
10
22
  /**
11
23
  * Reset columns (ASMA-8597): puts the column order and the widths back to the table's defaults, and the
12
- * sorting too when the table has `persistSorting`. It never unhides columns, and it removes the saved
13
- * entries of what it resets. Set by `StyledTable`, which knows the defaults.
24
+ * sorting too when the table has `persistSorting`. It removes the saved entries of what it resets. On a table
25
+ * with `persistColumnLayout` (ASMA-8695, OQ-02) it also puts the visibility back to the default, unhiding what
26
+ * the user hid and hiding what is hidden by default; any other table never touches visibility. Set by
27
+ * `StyledTable`, which knows the defaults.
14
28
  */
15
29
  resetColumnSettings: () => void;
30
+ /**
31
+ * Set by `StyledTable` on every render for a table with `persistColumnLayout`, and `undefined` for any other table
32
+ * (ASMA-8695, DEC-05): the column settings dot compares the layout with these defaults only where ui-core knows
33
+ * them. Some apps pass the user's current visibility as `initialState`, so elsewhere it cannot.
34
+ */
35
+ columnLayoutDefaults?: ColumnLayoutDefaults | undefined;
16
36
  }
@@ -7,6 +7,8 @@ export interface LeafColumnInfo {
7
7
  id: string;
8
8
  canSort: boolean;
9
9
  canMultiSort: boolean;
10
+ /** Whether the column settings popover may hide it (ASMA-8695: a saved visibility never holds a column that cannot). */
11
+ canHide: boolean;
10
12
  }
11
13
  /** The parts of a TanStack column definition that decide a column's id and whether it can sort. */
12
14
  export interface ColumnDefLike {
@@ -16,12 +18,14 @@ export interface ColumnDefLike {
16
18
  header?: unknown;
17
19
  enableSorting?: boolean;
18
20
  enableMultiSort?: boolean;
21
+ enableHiding?: boolean;
19
22
  columns?: readonly ColumnDefLike[];
20
23
  }
21
24
  export interface ColumnResolutionOptions {
22
25
  defaultColumn?: ColumnDefLike;
23
26
  enableSorting?: boolean;
24
27
  enableMultiSort?: boolean;
28
+ enableHiding?: boolean;
25
29
  }
26
30
  /** Leaf columns in definition order (group columns flattened), with the ids TanStack gives them. */
27
31
  export declare const getLeafColumnInfos: (columns: readonly ColumnDefLike[], options?: ColumnResolutionOptions) => LeafColumnInfo[];
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The controls in a table's header that Tab reaches, in DOM order, which is visual order: the fixed-left headers
3
+ * render first and the fixed-right ones last, the pin included. `thead` belongs to this table only: a table nested in a
4
+ * row has its own. A hidden header (`hideHeader`, marked `data-header-hidden`) has none: its built-in controls are not
5
+ * tab stops, and the focus is never sent to a control a consumer puts in it. Such a control stays a tab stop the browser
6
+ * reaches (a hidden header must not contain consumer tab stops: they set `tabIndex={-1}`, see the `hideHeader` prop).
7
+ */
8
+ export declare const getHeaderControls: (table: HTMLTableElement | null | undefined) => HTMLElement[];
9
+ /** The control Tab leaves the header from, and Shift+Tab from the body returns to; `undefined` with no controls. */
10
+ export declare const getLastHeaderControl: (table: HTMLTableElement | null | undefined) => HTMLElement | undefined;
11
+ /**
12
+ * The body row that holds the roving tab stop: the row the user last worked with. Rows of a table nested in a row
13
+ * are not this table's, so only the direct rows of its own bodies are looked at.
14
+ */
15
+ export declare const getActiveBodyRow: (table: HTMLTableElement | null | undefined) => HTMLTableRowElement | undefined;
@@ -5,7 +5,8 @@
5
5
  */
6
6
  export declare const tableStorage: {
7
7
  get(key: string): string | null;
8
- set(key: string, value: string): void;
8
+ /** `true` when the value was written, `false` when storage refused it (quota, blocked): the setting stays in memory only. */
9
+ set(key: string, value: string): boolean;
9
10
  remove(key: string): void;
10
11
  };
11
12
  /** Parses a saved value; anything that is not valid JSON counts as nothing saved. */
@@ -0,0 +1,77 @@
1
+ import { ColumnOrderState, Table, VisibilityState } from '@tanstack/react-table';
2
+ import { LeafColumnInfo } from '../helpers/columnIds';
3
+ export declare const getColumnOrderStorageKey: (uniqueKey?: string) => string | undefined;
4
+ export declare const getColumnVisibilityStorageKey: (uniqueKey?: string) => string | undefined;
5
+ /**
6
+ * Checks a parsed `:column-order` value. Ids that no column has are kept: an order saved for columns that are not there at
7
+ * the moment survives, and TanStack ignores them (ASMA-8597, DEC-W). `undefined` means nothing usable is saved.
8
+ */
9
+ export declare const sanitizeColumnOrder: (raw: unknown) => string[] | undefined;
10
+ /**
11
+ * Checks a parsed `:column-visibility` value and returns the valid differences, or `undefined` when nothing usable is saved.
12
+ * Values that are not booleans are dropped, and so are the ids of internal columns and of columns that cannot hide; **ids of
13
+ * columns that are not there at the moment are kept** (DEC-W).
14
+ */
15
+ export declare const sanitizeColumnVisibility: (raw: unknown, columns: readonly LeafColumnInfo[]) => Record<string, boolean> | undefined;
16
+ interface SavedColumnLayoutOptions {
17
+ /** `persistColumnLayout`. */
18
+ enabled: boolean;
19
+ uniqueKey: string | undefined;
20
+ /** `persistColumnOrderKey`: where the order used to be saved, unscoped. */
21
+ legacyOrderKey: string | undefined;
22
+ legacyVisibilityKey: string | undefined;
23
+ /** The leaf columns of this render, in definition order. */
24
+ columns: readonly LeafColumnInfo[];
25
+ /** `initialState.columnOrder`, or `[]`. */
26
+ defaultOrder: ColumnOrderState;
27
+ /** The whole visibility state the table opens with. */
28
+ defaultVisibility: VisibilityState;
29
+ }
30
+ export interface SavedColumnLayout {
31
+ orderKey: string | undefined;
32
+ visibilityKey: string | undefined;
33
+ /** The saved order to open with, missing columns at their definition position (DEC-03), for the columns of this render. */
34
+ order: string[] | undefined;
35
+ /** The whole visibility state to open with: this render's defaults with the saved differences on top. */
36
+ visibility: VisibilityState | undefined;
37
+ }
38
+ /**
39
+ * Reads the saved layout of the table's current key, once per key, and migrates the old unscoped entries once (D-MIGRATE).
40
+ * Reading is pure; the migration's writes and deletes happen in an effect, and are idempotent, so StrictMode's second run
41
+ * changes nothing. **An old entry is deleted only after the entry that replaces it is written**: when storage refuses the
42
+ * write (it is full or blocked) the old layout stays, and the next visit tries again. Needs to run before the table is
43
+ * created, because the saved layout is part of its initial state.
44
+ */
45
+ export declare const useSavedColumnLayout: (options: SavedColumnLayoutOptions) => SavedColumnLayout;
46
+ /**
47
+ * Keeps the table's state in step with the columns and the defaults of the current render (ASMA-8695, audit): the state was
48
+ * created from what the first render knew, and TanStack never revisits it.
49
+ *
50
+ * - **A new column** goes to its definition position in an order the user changed (DEC-03), as it does when a saved order is
51
+ * read; a user who has not moved anything stays on the definition order.
52
+ * - **A changed default** reaches the user who had not changed that column: the order follows the new `initialState.columnOrder`
53
+ * while the user is on the old default, and each column's visibility follows the new default unless the user changed it.
54
+ * What the user changed stays. Without this the dot would show a difference the user never made.
55
+ *
56
+ * Returns `true` for the render in which the state is not yet in step: the writers wait (nothing is saved for a state that is
57
+ * about to change), so a changed default is never saved as the user's choice.
58
+ */
59
+ export declare const useColumnLayoutReconcile: <TData>(table: Table<TData>, options: {
60
+ enabled: boolean;
61
+ definitionIds: readonly string[];
62
+ defaultOrder: ColumnOrderState;
63
+ defaultVisibility: VisibilityState;
64
+ controlledVisibility: boolean;
65
+ }) => boolean;
66
+ interface ColumnLayoutWriterOptions {
67
+ saved: SavedColumnLayout;
68
+ /** `true` in the render that finds new columns or defaults, before the state is brought in line: nothing is written yet. */
69
+ reconciling: boolean;
70
+ defaultOrder: ColumnOrderState;
71
+ defaultVisibility: VisibilityState;
72
+ /** The app owns `state.columnVisibility`: a key change blocks writes but does not set the state itself. */
73
+ controlledVisibility: boolean;
74
+ }
75
+ /** Saves the table's order and visibility under the keys of `saved`, by the storage rule of `usePersistedStateWriter`. */
76
+ export declare const useColumnLayoutWriter: <TData>(table: Table<TData>, options: ColumnLayoutWriterOptions) => void;
77
+ export {};
@@ -14,8 +14,8 @@ interface KeyboardSelectMenuOptions {
14
14
  optionCount: number;
15
15
  selectedIndex: number;
16
16
  onSelect: (index: number) => void;
17
- focusHeaderOnShiftTab?: boolean;
17
+ focusTableOnShiftTab?: boolean;
18
18
  }
19
19
  export declare const useToggleMenuVisibility: () => ToggleMenuVisibility;
20
- export declare const useKeyboardSelectMenu: ({ optionCount, selectedIndex, onSelect, focusHeaderOnShiftTab, }: KeyboardSelectMenuOptions) => KeyboardSelectMenu;
20
+ export declare const useKeyboardSelectMenu: ({ optionCount, selectedIndex, onSelect, focusTableOnShiftTab, }: KeyboardSelectMenuOptions) => KeyboardSelectMenu;
21
21
  export {};
@@ -26,6 +26,12 @@ declare module '@tanstack/react-table' {
26
26
  }
27
27
  interface TableMeta<TData extends RowData> {
28
28
  locale?: 'no' | 'en' | (TData extends never ? never : never);
29
+ /**
30
+ * @internal Set by `StyledTable` from its `hideHeader` prop, so that its own header controls (the sort header,
31
+ * the pin and the select-all checkbox) can drop their tab stops (ASMA-8702). Apps must not set it: the table
32
+ * writes it, and a `meta` an app passes replaces the table's. Use the `hideHeader` prop.
33
+ */
34
+ hideHeader?: boolean;
29
35
  }
30
36
  interface ColumnDefBase<TData extends RowData, TValue = unknown> extends ColumnDefExtensions<TData, TValue> {
31
37
  getUniqueValues?: AccessorFn<TData, unknown[]>;
@@ -114,6 +120,12 @@ export type StyledTableProps<TData, TCustomData> = {
114
120
  row: TData;
115
121
  }) => ReactElement | null;
116
122
  getRowSelectionIds?: (ids: string[]) => void;
123
+ /**
124
+ * Hides the header visually. It stays in the accessibility tree (column names and `aria-sort` are still announced)
125
+ * and its own controls (the sort header, the pin, the select-all checkbox) are not tab stops. **A hidden header must
126
+ * not contain tab stops of your own** (a button or link in a header cell): they stay tab stops with no visible focus.
127
+ * Give such a control `tabIndex={-1}`, or do not put one there (ASMA-8702).
128
+ */
117
129
  hideHeader?: boolean;
118
130
  pageSize?: number;
119
131
  enableResizing?: boolean;
@@ -139,6 +151,36 @@ export type StyledTableProps<TData, TCustomData> = {
139
151
  * makes `uniqueKey` alone enough and retires this prop (follow-up ASMA-8698).
140
152
  */
141
153
  persistSorting?: boolean;
154
+ /**
155
+ * Opt-in (ASMA-8695, D-OPTIN): save and restore this table's column order under `${uniqueKey}:column-order` and its
156
+ * column visibility under `${uniqueKey}:column-visibility`. Needs a per-user `uniqueKey` (`getTableSettingsKey` of
157
+ * asma-core-helpers); without one nothing is saved. Off by default: a table that does not set it behaves as before.
158
+ *
159
+ * Declare the layout the table opens with in `initialState.columnOrder` and `initialState.columnVisibility`; they are
160
+ * the defaults, so a column hidden by default is hidden for every user until one shows it. A saved layout beats them
161
+ * (the saved order and visibility, not `initialState`, decide what a user sees), the column settings dot follows the
162
+ * defaults (no dot for a column that is hidden by default), a column missing from a saved order appears at its
163
+ * definition position, and Reset columns also restores the default visibility.
164
+ *
165
+ * The table then owns visibility: do not pass `state.columnVisibility` or `onColumnVisibilityChange` (development builds
166
+ * warn). The old unscoped entries are migrated once, by the first user who opens the table on a browser, and then
167
+ * deleted (only after the user's own entry is written): `persistColumnOrderKey`'s order, and the visibility entry named by
168
+ * `legacyColumnVisibilityKey`. A table with this prop and no `uniqueKey` saves nothing and leaves the old entries alone.
169
+ *
170
+ * The table also keeps its state in step with its props: a column added later takes its definition position in an order
171
+ * the user changed, and a changed `initialState` default reaches the user who had not changed that column. A column that
172
+ * an order does not list, a saved one or `initialState.columnOrder`, appears at its definition position, not at the end
173
+ * (so a partial `initialState.columnOrder` no longer puts the listed columns first on a table that opts in).
174
+ */
175
+ persistColumnLayout?: boolean;
176
+ /**
177
+ * The key an app used to save its column visibility under before it opted in with `persistColumnLayout`: a raw
178
+ * `{ [columnId]: boolean }` map of the whole visibility state. It is read once, to carry the user's layout over into the
179
+ * user's own entry, and deleted once that entry is written (if storage refuses the write the old entry stays, and the
180
+ * next visit tries again). Reset columns deletes it too. Used only by a table with `persistColumnLayout` **and** a
181
+ * `uniqueKey`; without a key the table neither reads nor deletes it (ASMA-8695, D-MIGRATE).
182
+ */
183
+ legacyColumnVisibilityKey?: string;
142
184
  /**
143
185
  * Whether the table's columns can be resized with the pointer. **On by default** (ASMA-8597, UX round 4, D15): every data
144
186
  * column has a handle, except ui-core's own columns (select, expand, actions, drag handle, show full text), a column that
@@ -1,21 +1,22 @@
1
1
  import { ACTIONS_COLUMN_ID as w, INTERNAL_COLUMN_IDS as Re } from "../types.js";
2
2
  import { useRootContext as Se } from "../context/RootContext.js";
3
3
  import n from "./StyledTable.module.js";
4
- import { compact as De } from "../../helpers/arrays.js";
4
+ import { getLastHeaderControl as De } from "../helpers/headerControls.js";
5
+ import { compact as Ne } from "../../helpers/arrays.js";
5
6
  import V from "clsx";
6
- import { Fragment as Ne, useCallback as Y, useEffect as ve, useLayoutEffect as Ee, useMemo as R, useRef as Ie, useState as ye } from "react";
7
- import { Fragment as Te, jsx as s, jsxs as S } from "react/jsx-runtime";
8
- import { useSortable as ke } from "@dnd-kit/sortable";
9
- import { flexRender as Fe } from "@tanstack/react-table";
7
+ import { Fragment as ve, useCallback as Y, useEffect as Ee, useLayoutEffect as Ie, useMemo as R, useRef as ye, useState as Te } from "react";
8
+ import { Fragment as ke, jsx as s, jsxs as S } from "react/jsx-runtime";
9
+ import { useSortable as Fe } from "@dnd-kit/sortable";
10
+ import { flexRender as Le } from "@tanstack/react-table";
10
11
  import { CSS as Ae } from "@dnd-kit/utilities";
11
12
  var J = (D, t) => {
12
13
  const g = D.closest("table");
13
14
  if (!g) return !1;
14
- const N = t === "next" ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING, r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).filter((p) => !g.contains(p) && !!(g.compareDocumentPosition(p) & N)), l = t === "next" ? r[0] : r.at(-1);
15
+ const N = t === "next" ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING, r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).filter((h) => !g.contains(h) && !!(g.compareDocumentPosition(h) & N)), l = t === "next" ? r[0] : r.at(-1);
15
16
  return l ? (l.focus(), document.activeElement === l) : !1;
16
17
  };
17
- function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWindow: { paddingLeft: r, paddingRight: l, indexes: p } }) {
18
- const { loading: Q, getRowClassName: a, activeRowId: _, rowHeight: x, onRowClick: v, expandArrow: X, enableDnd: B, disableDndForRow: Z, tdClassName: H, customSubRowData: U, renderSubRows: ee, defaultExpanded: te, actions: E, customActionsNode: ne, stickyActions: ie, textExpandArrow: z, enableMultiRowSelection: oe, enableRowSelection: se, singleSelectionRow: le } = D, I = Z?.(t), { transform: ae, transition: ce, setNodeRef: W, isDragging: P } = ke({
18
+ function Ke({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWindow: { paddingLeft: r, paddingRight: l, indexes: h } }) {
19
+ const { loading: Q, getRowClassName: a, activeRowId: _, rowHeight: x, onRowClick: v, expandArrow: X, enableDnd: B, disableDndForRow: Z, tdClassName: H, customSubRowData: U, renderSubRows: ee, defaultExpanded: te, actions: E, customActionsNode: ne, stickyActions: ie, textExpandArrow: z, enableMultiRowSelection: oe, enableRowSelection: se, singleSelectionRow: le } = D, I = Z?.(t), { transform: ae, transition: ce, setNodeRef: W, isDragging: P } = Fe({
19
20
  id: t.original.id,
20
21
  disabled: !B || I
21
22
  }), de = {
@@ -24,28 +25,28 @@ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWin
24
25
  opacity: P ? 0.8 : 1,
25
26
  zIndex: P ? 1 : 0,
26
27
  position: "relative"
27
- }, { isResizing: re, disableResizingFlag: ue } = Se(), y = t.isExpanded(), C = Ie(null), [fe, me] = ye(void 0);
28
- Ee(() => {
28
+ }, { isResizing: re, disableResizingFlag: ue } = Se(), y = t.isExpanded(), C = ye(null), [fe, me] = Te(void 0);
29
+ Ie(() => {
29
30
  !y && C.current && me(C.current.cells[0]?.clientHeight ?? C.current.offsetHeight);
30
31
  }, [y]);
31
32
  const ge = Y((e) => {
32
33
  C.current = e, I || W(e);
33
34
  }, [I, W]), $ = y ? fe ?? x : x;
34
- ve(() => {
35
+ Ee(() => {
35
36
  te && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
36
37
  }, []);
37
38
  const j = (e) => {
38
39
  t.getCanExpand() && !X && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
39
40
  const i = window.getSelection()?.type !== "Range" && !re, o = v instanceof Function;
40
41
  !o && z && i ? t.toggleExpand() : o && i && v(e, t), ue();
41
- }, he = (e) => {
42
- e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || j(e);
43
42
  }, pe = (e) => {
43
+ e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || j(e);
44
+ }, he = (e) => {
44
45
  if (e.target === e.currentTarget)
45
46
  switch (e.key) {
46
47
  case "Tab":
47
48
  if (e.shiftKey) {
48
- const i = e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]');
49
+ const i = De(e.currentTarget.closest("table"));
49
50
  i ? (e.preventDefault(), i.focus()) : J(e.currentTarget, "prev") && e.preventDefault();
50
51
  } else J(e.currentTarget, "next") && e.preventDefault();
51
52
  break;
@@ -62,16 +63,16 @@ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWin
62
63
  }, c = t.getVisibleCells().map((e, i, o) => ({
63
64
  ...e,
64
65
  left: o.slice(0, i).reduce((f, m) => f + (m.column.getSize() ?? 0), 0)
65
- })), T = !!E || !!ne, k = c.some((e) => !!e.column.columnDef.fixedRight), d = ie ?? (T || k), q = R(() => c.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [c]), h = R(() => c.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions" && d).map((e, i, o) => ({
66
+ })), T = !!E || !!ne, k = c.some((e) => !!e.column.columnDef.fixedRight), d = ie ?? (T || k), G = R(() => c.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [c]), p = R(() => c.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions" && d).map((e, i, o) => ({
66
67
  ...e,
67
68
  right: o.slice(i + 1).reduce((f, m) => f + (m.column.getSize() ?? 0), 0)
68
- })), [c, d]), G = R(() => h.some((e) => e.column.id === w), [h]), K = d ? void 0 : c.find((e) => e.column.id === w), u = R(() => c.filter((e) => e.column.columnDef.fixedLeft), [c]), F = !oe && !se && le, A = t.getIsSelected() && F, L = v instanceof Function, M = p.length > 0 ? De(p.map((e) => q[e])) : q, b = Y((e, i) => {
69
- const o = e.column.id === w, f = e.column.columnDef.fixedLeft, m = !!e.column.columnDef.fixedRight, xe = e.id === u.at(-1)?.id, Ce = e.id === h.at(0)?.id && !o, be = t.isExpanded(), O = i === 0;
69
+ })), [c, d]), K = R(() => p.some((e) => e.column.id === w), [p]), q = d ? void 0 : c.find((e) => e.column.id === w), u = R(() => c.filter((e) => e.column.columnDef.fixedLeft), [c]), F = !oe && !se && le, L = t.getIsSelected() && F, A = v instanceof Function, M = h.length > 0 ? Ne(h.map((e) => G[e])) : G, b = Y((e, i) => {
70
+ const o = e.column.id === w, f = e.column.columnDef.fixedLeft, m = !!e.column.columnDef.fixedRight, xe = e.id === u.at(-1)?.id, Ce = e.id === p.at(0)?.id && !o, be = t.isExpanded(), O = i === 0;
70
71
  return /* @__PURE__ */ s("td", {
71
- className: V(n["t-cell"], !Re.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], L && "cursor-pointer", H, o && d && n["action-cell"], o && d && (!T || k) && n["action-cell--no-shadow"], o && d && !!E && u.length && n.shadowed, o && d && (a?.(t) ? a?.(t) : n["action-cell-default-background"]), f && n["fixed-cell"], m && n["fixed-right-cell"], xe && n.shadowed, Ce && n["shadowed-right"], t.getIsSelected() && n.selected, f && (a?.(t) ? a?.(t) : n["fixed-cell-default-background"]), m && (a?.(t) ? a?.(t) : n["fixed-right-cell-default-background"]), be && n.expanded_row, !!A && n["single-selection"]),
72
+ className: V(n["t-cell"], !Re.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], A && "cursor-pointer", H, o && d && n["action-cell"], o && d && (!T || k) && n["action-cell--no-shadow"], o && d && !!E && u.length && n.shadowed, o && d && (a?.(t) ? a?.(t) : n["action-cell-default-background"]), f && n["fixed-cell"], m && n["fixed-right-cell"], xe && n.shadowed, Ce && n["shadowed-right"], t.getIsSelected() && n.selected, f && (a?.(t) ? a?.(t) : n["fixed-cell-default-background"]), m && (a?.(t) ? a?.(t) : n["fixed-right-cell-default-background"]), be && n.expanded_row, !!L && n["single-selection"]),
72
73
  style: {
73
74
  left: f ? e.left : void 0,
74
- right: m ? e.right + (G ? -1 : 0) : void 0
75
+ right: m ? e.right + (K ? -1 : 0) : void 0
75
76
  },
76
77
  children: /* @__PURE__ */ S("div", {
77
78
  style: {
@@ -81,7 +82,7 @@ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWin
81
82
  minHeight: $,
82
83
  position: "relative"
83
84
  },
84
- children: [O && A && /* @__PURE__ */ s("span", {
85
+ children: [O && L && /* @__PURE__ */ s("span", {
85
86
  style: {
86
87
  display: "inline-flex",
87
88
  alignItems: "center",
@@ -90,33 +91,33 @@ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWin
90
91
  top: "50%",
91
92
  transform: "translateY(-50%)"
92
93
  },
93
- children: /* @__PURE__ */ s(Le, {})
94
+ children: /* @__PURE__ */ s(Me, {})
94
95
  }), /* @__PURE__ */ s("span", {
95
96
  style: {
96
97
  marginLeft: O && F ? 30 : 0,
97
98
  width: "100%"
98
99
  },
99
- children: Fe(e.column.columnDef.cell, e.getContext())
100
+ children: Le(e.column.columnDef.cell, e.getContext())
100
101
  })]
101
102
  })
102
103
  }, e.id);
103
104
  }, [
104
- A,
105
+ L,
105
106
  E,
106
107
  $,
107
108
  a,
108
- L,
109
- G,
109
+ A,
110
+ K,
110
111
  k,
111
112
  u,
112
- h,
113
+ p,
113
114
  t,
114
115
  T,
115
116
  d,
116
117
  F,
117
118
  H
118
119
  ]);
119
- return /* @__PURE__ */ S(Ne, { children: [/* @__PURE__ */ S("tr", {
120
+ return /* @__PURE__ */ S(ve, { children: [/* @__PURE__ */ S("tr", {
120
121
  "aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
121
122
  tabIndex: t.isFocused() || g === 0 && !N ? 0 : -1,
122
123
  "data-index": g,
@@ -132,11 +133,11 @@ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWin
132
133
  onFocus: (e) => {
133
134
  e.target === e.currentTarget && !t.isFocused() && t.onChangeFocused(!0);
134
135
  },
135
- onMouseUp: he,
136
+ onMouseUp: pe,
136
137
  onMouseDown: (e) => {
137
- e.detail > 1 && !L && z && e.preventDefault();
138
+ e.detail > 1 && !A && z && e.preventDefault();
138
139
  },
139
- onKeyDownCapture: pe,
140
+ onKeyDownCapture: he,
140
141
  children: [
141
142
  u.map((e, i) => b(e, i)),
142
143
  r > 0 && /* @__PURE__ */ s("td", {
@@ -162,15 +163,15 @@ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWin
162
163
  border: "none"
163
164
  }
164
165
  }),
165
- h.map((e, i) => b(e, u.length + M.length + i)),
166
- K && b(K, u.length + M.length + h.length)
166
+ p.map((e, i) => b(e, u.length + M.length + i)),
167
+ q && b(q, u.length + M.length + p.length)
167
168
  ]
168
- }), t.getIsExpanded() && /* @__PURE__ */ s(Te, { children: U && ee?.({
169
+ }), t.getIsExpanded() && /* @__PURE__ */ s(ke, { children: U && ee?.({
169
170
  rows: U.get(t.original.id.toString()) ?? [],
170
171
  row: t.original
171
172
  }) })] }, t.id);
172
173
  }
173
- var Le = () => /* @__PURE__ */ S("svg", {
174
+ var Me = () => /* @__PURE__ */ S("svg", {
174
175
  xmlns: "http://www.w3.org/2000/svg",
175
176
  width: "20",
176
177
  height: "20",
@@ -182,5 +183,5 @@ var Le = () => /* @__PURE__ */ S("svg", {
182
183
  })]
183
184
  });
184
185
  export {
185
- je as TableRow
186
+ Ke as TableRow
186
187
  };
@@ -1,6 +1,6 @@
1
- import { cn as N } from "../../../../../helpers/cn.js";
2
- import { StyledBadge as _ } from "../../../../../components/data-display/badge/StyledBadge.js";
3
- import { PinIcon as v } from "../../../../../components/icons/pin-icon/PinIcon.js";
1
+ import { cn as v } from "../../../../../helpers/cn.js";
2
+ import { StyledBadge as N } from "../../../../../components/data-display/badge/StyledBadge.js";
3
+ import { PinIcon as _ } from "../../../../../components/icons/pin-icon/PinIcon.js";
4
4
  import { StyledPopover as D } from "../../../../../components/utils/popover/StyledPopover.js";
5
5
  import { message as T } from "../../../../../components/feedback/snack-bar/message.js";
6
6
  import { INTERNAL_COLUMN_IDS as L } from "../../../../types.js";
@@ -52,9 +52,10 @@ function be({ headerData: n, locale: p }) {
52
52
  "aria-label": m ? s.column_settings_changed : s.column_settings,
53
53
  "aria-haspopup": "true",
54
54
  "aria-expanded": c,
55
+ tabIndex: n.table.options.meta?.hideHeader ? -1 : void 0,
55
56
  className: f["actions-header"],
56
57
  onClick: g,
57
- children: [/* @__PURE__ */ o(v, { className: f["pin-icon"] }), m && /* @__PURE__ */ o(_, {
58
+ children: [/* @__PURE__ */ o(_, { className: f["pin-icon"] }), m && /* @__PURE__ */ o(N, {
58
59
  dataTest: "column-settings-dot",
59
60
  variant: "dot",
60
61
  purpose: "filter",
@@ -111,7 +112,7 @@ function be({ headerData: n, locale: p }) {
111
112
  userSelect: "none",
112
113
  WebkitTouchCallout: "none"
113
114
  },
114
- className: N(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
115
+ className: v(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
115
116
  }),
116
117
  /* @__PURE__ */ o("span", {
117
118
  className: "px-2",
@@ -1,5 +1,5 @@
1
1
  import { SELECT_COLUMN_ID as g } from "../../types.js";
2
- import c from "../StyledTable.module.js";
2
+ import n from "../StyledTable.module.js";
3
3
  import { StyledCheckbox as i } from "../../shared-components/StyledCheckbox.js";
4
4
  import { StyledTooltip as S } from "../../shared-components/tooltip/index.js";
5
5
  import { jsx as r } from "react/jsx-runtime";
@@ -15,7 +15,7 @@ var s = (o) => {
15
15
  selectRow: (l) => `Select row ${l}`
16
16
  };
17
17
  function v(o, l, m) {
18
- const n = h(m);
18
+ const c = h(m);
19
19
  return {
20
20
  id: g,
21
21
  minSize: 38,
@@ -23,10 +23,10 @@ function v(o, l, m) {
23
23
  size: 38,
24
24
  header: ({ table: e }) => /* @__PURE__ */ r("div", {
25
25
  role: "checkbox",
26
- tabIndex: 0,
27
- "aria-label": n.selectAll,
26
+ tabIndex: e.options.meta?.hideHeader ? -1 : 0,
27
+ "aria-label": c.selectAll,
28
28
  "aria-checked": e.getIsSomeRowsSelected() ? "mixed" : e.getIsAllRowsSelected(),
29
- className: c["select-control"],
29
+ className: n["select-control"],
30
30
  onClick: () => e.toggleAllRowsSelected(),
31
31
  onMouseDown: s,
32
32
  onMouseUp: s,
@@ -46,11 +46,11 @@ function v(o, l, m) {
46
46
  return /* @__PURE__ */ r("div", {
47
47
  role: "checkbox",
48
48
  tabIndex: t ? -1 : 0,
49
- "aria-label": n.selectRow(e.row.index + 1),
49
+ "aria-label": c.selectRow(e.row.index + 1),
50
50
  "aria-checked": e.row.getIsSelected(),
51
51
  "aria-disabled": t,
52
52
  style: { height: l ?? "auto" },
53
- className: c["select-control"],
53
+ className: n["select-control"],
54
54
  onClick: () => {
55
55
  t || e.row.toggleSelected();
56
56
  },
@@ -64,7 +64,7 @@ function v(o, l, m) {
64
64
  placement: "top-start",
65
65
  title: e.row.getRowSelectionTooltip(),
66
66
  children: /* @__PURE__ */ r("span", {
67
- className: t ? c["cursor-not-allowed"] : void 0,
67
+ className: t ? n["cursor-not-allowed"] : void 0,
68
68
  children: /* @__PURE__ */ r(i, {
69
69
  size: "small",
70
70
  dataTest: "cell-select",
@@ -13,8 +13,8 @@ var R = [
13
13
  50,
14
14
  100
15
15
  ];
16
- function A({ table: l, locale: w }) {
17
- const e = l.getState().pagination.pageSize, c = w === "no", t = N(), h = g(() => ({
16
+ function B({ table: l, locale: b }) {
17
+ const e = l.getState().pagination.pageSize, c = b === "no", t = N(), h = g(() => ({
18
18
  anchorOrigin: {
19
19
  vertical: -5,
20
20
  horizontal: "center"
@@ -28,11 +28,11 @@ function A({ table: l, locale: w }) {
28
28
  return Array.from(o).sort((a, i) => a - i);
29
29
  }, [e]), f = D((o) => {
30
30
  l.setPageSize(o);
31
- }, [l]), b = r.indexOf(e), { anchorEl: d, open: n, handleClose: u, handleOpen: v, triggerRef: S, activeIndex: p, handleKeyDown: x } = $({
31
+ }, [l]), w = r.indexOf(e), { anchorEl: d, open: n, handleClose: u, handleOpen: v, triggerRef: S, activeIndex: p, handleKeyDown: x } = $({
32
32
  optionCount: r.length,
33
- selectedIndex: b,
33
+ selectedIndex: w,
34
34
  onSelect: (o) => f(r[o]),
35
- focusHeaderOnShiftTab: !0
35
+ focusTableOnShiftTab: !0
36
36
  });
37
37
  return /* @__PURE__ */ m(P, { children: [/* @__PURE__ */ m(k, {
38
38
  dataTest: "table-rows-count-button",
@@ -95,5 +95,5 @@ function A({ table: l, locale: w }) {
95
95
  })] });
96
96
  }
97
97
  export {
98
- A as TableRowCountSelect
98
+ B as TableRowCountSelect
99
99
  };