@slashsuite/ui-react 0.16.0 → 0.16.1
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/agent-docs/components/table.md +1 -1
- package/dist/Table.d.ts +2 -1
- package/dist/Table.js +5 -4
- package/dist/tableColumns.d.ts +6 -0
- package/dist/tableColumns.js +1 -0
- package/package.json +1 -1
|
@@ -277,7 +277,7 @@ down a column.
|
|
|
277
277
|
new direction.
|
|
278
278
|
|
|
279
279
|
### TableHead
|
|
280
|
-
The `<thead>`: small uppercase column titles, on a tinted strip unless the table is in a card. Holds one `TableRow` of `TableHeaderCell`s. Unless the table is in a card, it stays in view under the `AppShell` header while the page scrolls past the rows,
|
|
280
|
+
The `<thead>`: small uppercase column titles, on a tinted strip unless the table is in a card. Holds one `TableRow` of `TableHeaderCell`s. Unless the table is in a card, it stays in view under the `AppShell` header while the page scrolls past the rows, once the table is measured and fits its box; before that, and while the table is wider than its box, it stays at the top of the table.
|
|
281
281
|
|
|
282
282
|
### TableBody
|
|
283
283
|
The `<tbody>`: the rows, each with a line above it and, unless the table is in a card, a fill on hover. With no rows it draws `empty` (an `EmptyState`, one muted line here) in one cell that spans every column the head declares; the head stays drawn, so the reader sees what the table holds. In a loading `Table` a body with no rows draws five rows of bones instead, never `empty`.
|
package/dist/Table.d.ts
CHANGED
|
@@ -47,7 +47,8 @@ export declare function Table({ label, size, narrow, sortedLabel, loading, loadi
|
|
|
47
47
|
/**
|
|
48
48
|
* The `<thead>`: small uppercase column titles, on a tinted strip unless the table is in a card.
|
|
49
49
|
* Holds one `TableRow` of `TableHeaderCell`s. Unless the table is in a card, it stays in view under
|
|
50
|
-
* the `AppShell` header while the page scrolls past the rows,
|
|
50
|
+
* the `AppShell` header while the page scrolls past the rows, once the table is measured and fits
|
|
51
|
+
* its box; before that, and while the table is wider than its box, it stays at the top of the table.
|
|
51
52
|
*/
|
|
52
53
|
export declare function TableHead({ children, ...rest }: {
|
|
53
54
|
children: ReactNode;
|
package/dist/Table.js
CHANGED
|
@@ -40,7 +40,7 @@ export function Table({ label, size = "sm", narrow = "scroll", sortedLabel = eng
|
|
|
40
40
|
// Until measured (a page rendered on the server) and while too wide, the box scrolls sideways.
|
|
41
41
|
// Once it fits, it clips instead: a clipping box is no scroll container, so the head can stick.
|
|
42
42
|
const fits = measured && !overflows;
|
|
43
|
-
return (_jsx(TableContext.Provider, { value: { plain, size, numeric, columns, announce, stack, titles }, children: _jsx(DensityProvider, { size: size, children: _jsxs("div", { ref: attach, ...stopProps, className: cx(fits ? "overflow-clip" : "overflow-x-auto", ring, !plain && "rounded-xl border border-slate-200/70 bg-white shadow-sm"), children: [_jsxs("table", { ...rest, ...stackRole(stack, "table"), ...busy(owner, waiting), className: cx("w-full text-left text-sm", stack && STACK.table), children: [_jsx("caption", { className: "sr-only", children: label }), _jsx(LoadingScope, { loading: waiting, children: children })] }), _jsx(BusyLabel, { owner: owner, loading: waiting, label: loadingLabel }), _jsx("div", { role: "status", className: "sr-only", children: said })] }) }) }));
|
|
43
|
+
return (_jsx(TableContext.Provider, { value: { plain, fits, size, numeric, columns, announce, stack, titles }, children: _jsx(DensityProvider, { size: size, children: _jsxs("div", { ref: attach, ...stopProps, className: cx(fits ? "overflow-clip" : "overflow-x-auto", ring, !plain && "rounded-xl border border-slate-200/70 bg-white shadow-sm"), children: [_jsxs("table", { ...rest, ...stackRole(stack, "table"), ...busy(owner, waiting), className: cx("w-full text-left text-sm", stack && STACK.table), children: [_jsx("caption", { className: "sr-only", children: label }), _jsx(LoadingScope, { loading: waiting, children: children })] }), _jsx(BusyLabel, { owner: owner, loading: waiting, label: loadingLabel }), _jsx("div", { role: "status", className: "sr-only", children: said })] }) }) }));
|
|
44
44
|
}
|
|
45
45
|
/** The default `sortedLabel`. */
|
|
46
46
|
function englishSorted(column, sort) {
|
|
@@ -54,11 +54,12 @@ function tableWider(box) {
|
|
|
54
54
|
/**
|
|
55
55
|
* The `<thead>`: small uppercase column titles, on a tinted strip unless the table is in a card.
|
|
56
56
|
* Holds one `TableRow` of `TableHeaderCell`s. Unless the table is in a card, it stays in view under
|
|
57
|
-
* the `AppShell` header while the page scrolls past the rows,
|
|
57
|
+
* the `AppShell` header while the page scrolls past the rows, once the table is measured and fits
|
|
58
|
+
* its box; before that, and while the table is wider than its box, it stays at the top of the table.
|
|
58
59
|
*/
|
|
59
60
|
export function TableHead({ children, ...rest }) {
|
|
60
|
-
const { plain, stack } = useContext(TableContext);
|
|
61
|
-
return (_jsx("thead", { ...rest, ...stackRole(stack, "rowgroup"), className: cx("text-sm uppercase tracking-wide text-slate-500", !plain && "sticky top-[var(--app-header,0px)] z-1
|
|
61
|
+
const { plain, fits, stack } = useContext(TableContext);
|
|
62
|
+
return (_jsx("thead", { ...rest, ...stackRole(stack, "rowgroup"), className: cx("text-sm uppercase tracking-wide text-slate-500", !plain && "bg-slate-50", !plain && fits && "sticky top-[var(--app-header,0px)] z-1", stack && STACK.head), children: _jsx(SectionContext.Provider, { value: "head", children: children }) }));
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* The `<tbody>`: the rows, each with a line above it and, unless the table is in a card, a fill on
|
package/dist/tableColumns.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ import type { Size } from "./size.js";
|
|
|
6
6
|
*/
|
|
7
7
|
type TableSetting = {
|
|
8
8
|
plain: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the table was measured and fits its box. Only then does the box clip instead of
|
|
11
|
+
* scroll, so only then can the head stick to the page: inside a box that scrolls sideways a
|
|
12
|
+
* sticky head sticks to that box, pushed down over the rows by the app header's height.
|
|
13
|
+
*/
|
|
14
|
+
fits: boolean;
|
|
9
15
|
size: Size;
|
|
10
16
|
numeric: readonly boolean[];
|
|
11
17
|
/** How many columns the head declares, or `undefined` with no `TableHead`. */
|
package/dist/tableColumns.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slashsuite/ui-react",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "UISlash React components: primitives, typography roles and a safe Markdown renderer, written against Tailwind v4 utilities. Pair with a theme from @slashsuite/themes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|