@ai-matrx/design-system 0.61.22 → 0.61.23
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.
- package/CHANGELOG.md +6 -0
- package/dist/desktop.cjs +21 -15
- package/dist/desktop.cjs.map +1 -1
- package/dist/desktop.d.cts +3 -1
- package/dist/desktop.d.ts +3 -1
- package/dist/desktop.js +21 -15
- package/dist/desktop.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/desktop.d.cts
CHANGED
|
@@ -304,13 +304,15 @@ interface DataTableProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, "
|
|
|
304
304
|
defaultSort?: SortState;
|
|
305
305
|
/** `data-*` attributes for a row (test hooks, state markers). */
|
|
306
306
|
rowData?: (row: T) => Record<`data-${string}`, string | undefined>;
|
|
307
|
+
/** Draw only the first `limit` rows AFTER sorting (long lists: the caller offers "Show more"). */
|
|
308
|
+
limit?: number;
|
|
307
309
|
className?: string;
|
|
308
310
|
}
|
|
309
311
|
/**
|
|
310
312
|
* The macOS table: 24 px rows, caption-weight headers, hairline under the header, optional
|
|
311
313
|
* alternating rows, tint selection. Arrow keys move between rows when rows are selectable.
|
|
312
314
|
*/
|
|
313
|
-
declare function DataTable<T>({ columns, rows, rowKey, onRowSelect, selectedKey, empty, striped, detail, isDisabled, rowAction, rowMenu, defaultSort, rowData, className, "aria-label": ariaLabel, ...rest }: DataTableProps<T>): React.JSX.Element;
|
|
315
|
+
declare function DataTable<T>({ columns, rows, rowKey, onRowSelect, selectedKey, empty, striped, detail, isDisabled, rowAction, rowMenu, defaultSort, rowData, limit, className, "aria-label": ariaLabel, ...rest }: DataTableProps<T>): React.JSX.Element;
|
|
314
316
|
|
|
315
317
|
/**
|
|
316
318
|
* The source list (Finder / Mail / Notes sidebar). Sections of 28 px rows; the open row carries a
|
package/dist/desktop.d.ts
CHANGED
|
@@ -304,13 +304,15 @@ interface DataTableProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, "
|
|
|
304
304
|
defaultSort?: SortState;
|
|
305
305
|
/** `data-*` attributes for a row (test hooks, state markers). */
|
|
306
306
|
rowData?: (row: T) => Record<`data-${string}`, string | undefined>;
|
|
307
|
+
/** Draw only the first `limit` rows AFTER sorting (long lists: the caller offers "Show more"). */
|
|
308
|
+
limit?: number;
|
|
307
309
|
className?: string;
|
|
308
310
|
}
|
|
309
311
|
/**
|
|
310
312
|
* The macOS table: 24 px rows, caption-weight headers, hairline under the header, optional
|
|
311
313
|
* alternating rows, tint selection. Arrow keys move between rows when rows are selectable.
|
|
312
314
|
*/
|
|
313
|
-
declare function DataTable<T>({ columns, rows, rowKey, onRowSelect, selectedKey, empty, striped, detail, isDisabled, rowAction, rowMenu, defaultSort, rowData, className, "aria-label": ariaLabel, ...rest }: DataTableProps<T>): React.JSX.Element;
|
|
315
|
+
declare function DataTable<T>({ columns, rows, rowKey, onRowSelect, selectedKey, empty, striped, detail, isDisabled, rowAction, rowMenu, defaultSort, rowData, limit, className, "aria-label": ariaLabel, ...rest }: DataTableProps<T>): React.JSX.Element;
|
|
314
316
|
|
|
315
317
|
/**
|
|
316
318
|
* The source list (Finder / Mail / Notes sidebar). Sections of 28 px rows; the open row carries a
|
package/dist/desktop.js
CHANGED
|
@@ -1949,6 +1949,7 @@ function DataTable({
|
|
|
1949
1949
|
rowMenu,
|
|
1950
1950
|
defaultSort,
|
|
1951
1951
|
rowData,
|
|
1952
|
+
limit,
|
|
1952
1953
|
className,
|
|
1953
1954
|
"aria-label": ariaLabel,
|
|
1954
1955
|
...rest
|
|
@@ -1964,11 +1965,12 @@ function DataTable({
|
|
|
1964
1965
|
const [sort, setSort] = React18.useState(defaultSort ?? null);
|
|
1965
1966
|
const sortColumn = sort ? columns.find((c) => c.key === sort.key && c.sort) : void 0;
|
|
1966
1967
|
const ordered = React18.useMemo(() => {
|
|
1967
|
-
|
|
1968
|
+
const cut = (list) => limit !== void 0 && list.length > limit ? list.slice(0, limit) : list;
|
|
1969
|
+
if (!sort || !sortColumn?.sort) return cut(rows);
|
|
1968
1970
|
const by = sortColumn.sort;
|
|
1969
1971
|
const sign = sort.direction === "ascending" ? 1 : -1;
|
|
1970
|
-
return [...rows].sort((a, b) => sign * by(a, b));
|
|
1971
|
-
}, [rows, sort, sortColumn]);
|
|
1972
|
+
return cut([...rows].sort((a, b) => sign * by(a, b)));
|
|
1973
|
+
}, [rows, sort, sortColumn, limit]);
|
|
1972
1974
|
const toggleSort = (key) => setSort((prev) => prev?.key === key ? { key, direction: prev.direction === "ascending" ? "descending" : "ascending" } : { key, direction: "descending" });
|
|
1973
1975
|
const hasActions = Boolean(rowAction || rowMenu);
|
|
1974
1976
|
const span = columns.length + (detail ? 1 : 0) + (hasActions ? 1 : 0);
|
|
@@ -2021,7 +2023,7 @@ function DataTable({
|
|
|
2021
2023
|
column.key
|
|
2022
2024
|
);
|
|
2023
2025
|
}),
|
|
2024
|
-
hasActions ? /* @__PURE__ */ jsx22("th", { "aria-label": "Actions", className: "w-
|
|
2026
|
+
hasActions ? /* @__PURE__ */ jsx22("th", { "aria-label": "Actions", className: "w-0 p-0" }) : null
|
|
2025
2027
|
] }) }),
|
|
2026
2028
|
rows.length === 0 && empty ? /* @__PURE__ */ jsx22("tbody", { children: /* @__PURE__ */ jsx22("tr", { children: /* @__PURE__ */ jsx22("td", { colSpan: span, children: empty }) }) }) : /* @__PURE__ */ jsx22("tbody", { ref: bodyRef, children: ordered.map((row, index) => {
|
|
2027
2029
|
const key = rowKey(row);
|
|
@@ -2084,16 +2086,20 @@ function DataTable({
|
|
|
2084
2086
|
},
|
|
2085
2087
|
column.key
|
|
2086
2088
|
)),
|
|
2087
|
-
hasActions ?
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2089
|
+
hasActions ? (
|
|
2090
|
+
// Zero width: the buttons float over the row's trailing edge instead of reserving
|
|
2091
|
+
// an empty column (Finder). They appear on hover, keyboard focus or selection.
|
|
2092
|
+
/* @__PURE__ */ jsx22("td", { className: "relative w-0 p-0", children: /* @__PURE__ */ jsx22(
|
|
2093
|
+
"span",
|
|
2094
|
+
{
|
|
2095
|
+
className: cn(
|
|
2096
|
+
"absolute right-2 top-1/2 flex -translate-y-1/2 items-center rounded-control bg-content pl-2",
|
|
2097
|
+
!selected && "opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 has-[[data-state=open]]:opacity-100",
|
|
2098
|
+
selected && "bg-selection"
|
|
2099
|
+
),
|
|
2100
|
+
children: /* @__PURE__ */ jsx22(RowActions, { action: rowAction?.(row) ?? null, menu: rowMenu?.(row) ?? null })
|
|
2101
|
+
}
|
|
2102
|
+
) })
|
|
2097
2103
|
) : null
|
|
2098
2104
|
]
|
|
2099
2105
|
}
|
|
@@ -2188,7 +2194,7 @@ var SourceListItem = React19.forwardRef(function SourceListItem2({ icon, label,
|
|
|
2188
2194
|
className: cn(
|
|
2189
2195
|
"focus-ring group/item flex w-full items-center gap-2 rounded-control px-2 text-left text-body text-label transition-colors duration-100 hover:bg-fill disabled:opacity-40",
|
|
2190
2196
|
hint && !soon ? "min-h-row py-1" : "h-sidebar-row",
|
|
2191
|
-
soon && "text-label-tertiary",
|
|
2197
|
+
soon && (current ? "text-label-secondary" : "text-label-tertiary"),
|
|
2192
2198
|
current && "bg-selection-muted font-medium hover:bg-selection-muted [[data-window-active=false]_&]:bg-fill",
|
|
2193
2199
|
className
|
|
2194
2200
|
),
|