@milktop/react-ui 0.2.5 → 0.2.6
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/dist/table/Table.d.ts +1 -1
- package/dist/table/Table.js +2 -2
- package/dist/table/table.css +2 -2
- package/package.json +1 -1
package/dist/table/Table.d.ts
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* - `size`: 'sm', 'md' (default) or 'lg' (roomier rows)
|
|
34
34
|
* - `flush`: no border or rounding, to sit edge to edge in a card
|
|
35
35
|
* - `onRowClick`: called with the row when a row is clicked (outside its
|
|
36
|
-
* controls), unless rows are ticked
|
|
36
|
+
* controls), unless rows are ticked; rows then show the pointer
|
|
37
37
|
*
|
|
38
38
|
* Or write the <table> yourself as its content, for the look alone (no
|
|
39
39
|
* sorting, selection or loading states); `data-align` on cells works too.
|
package/dist/table/Table.js
CHANGED
|
@@ -34,7 +34,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
34
34
|
* - `size`: 'sm', 'md' (default) or 'lg' (roomier rows)
|
|
35
35
|
* - `flush`: no border or rounding, to sit edge to edge in a card
|
|
36
36
|
* - `onRowClick`: called with the row when a row is clicked (outside its
|
|
37
|
-
* controls), unless rows are ticked
|
|
37
|
+
* controls), unless rows are ticked; rows then show the pointer
|
|
38
38
|
*
|
|
39
39
|
* Or write the <table> yourself as its content, for the look alone (no
|
|
40
40
|
* sorting, selection or loading states); `data-align` on cells works too.
|
|
@@ -141,7 +141,7 @@ export function Table({ columns = [], rows = [], rowKey = 'id', selectable = fal
|
|
|
141
141
|
onRowClick?.(row);
|
|
142
142
|
}
|
|
143
143
|
const columnCount = columns.length + (selectable ? 1 : 0);
|
|
144
|
-
return (_jsx("div", { ...rest, ...part('root'), className: cx(className, classes?.root), "data-size": size, "data-flush": flush || undefined, "data-selecting": selecting || undefined, "data-loading": (loading && rows.length > 0) || undefined, children: _jsx("div", { ...part('scroll'), "data-sticky": maxHeight ? '' : undefined, style: maxHeight ? { maxHeight } : undefined, children: !columns.length ? children : (_jsxs("table", { ...part('table'), "aria-busy": loading, children: [label && _jsx("caption", { ...part('caption'), children: label }), _jsx("thead", { children: _jsxs("tr", { children: [selectable && (_jsx("th", { ...part('select-cell'), scope: "col", children: _jsx(Checkbox, { label: t.table.selectAll, labelHidden: true, disabled: !rows.length, checked: allState, onCheckedChange: (on) => toggleAll(on) }) })), columns.map((column) => (_jsx("th", { scope: "col", "data-align": column.align ?? 'start', "aria-sort": ariaSort(column), style: column.width ? { width: column.width } : undefined, children: column.sortable
|
|
144
|
+
return (_jsx("div", { ...rest, ...part('root'), className: cx(className, classes?.root), "data-size": size, "data-flush": flush || undefined, "data-clickable": onRowClick ? '' : undefined, "data-selecting": selecting || undefined, "data-loading": (loading && rows.length > 0) || undefined, children: _jsx("div", { ...part('scroll'), "data-sticky": maxHeight ? '' : undefined, style: maxHeight ? { maxHeight } : undefined, children: !columns.length ? children : (_jsxs("table", { ...part('table'), "aria-busy": loading, children: [label && _jsx("caption", { ...part('caption'), children: label }), _jsx("thead", { children: _jsxs("tr", { children: [selectable && (_jsx("th", { ...part('select-cell'), scope: "col", children: _jsx(Checkbox, { label: t.table.selectAll, labelHidden: true, disabled: !rows.length, checked: allState, onCheckedChange: (on) => toggleAll(on) }) })), columns.map((column) => (_jsx("th", { scope: "col", "data-align": column.align ?? 'start', "aria-sort": ariaSort(column), style: column.width ? { width: column.width } : undefined, children: column.sortable
|
|
145
145
|
? _jsxs("button", { ...part('sort'), type: "button", "data-dir": sortDir(column) ?? undefined, onClick: () => toggleSort(column), children: [_jsx("span", { children: column.label }), _jsx("span", { ...part('sort-icon'), children: _jsx("iconify-icon", { icon: sortDir(column) === 'asc' ? 'lucide:chevron-up'
|
|
146
146
|
: sortDir(column) === 'desc' ? 'lucide:chevron-down' : 'lucide:chevrons-up-down' }) })] })
|
|
147
147
|
: column.label }, column.key)))] }) }), _jsx("tbody", { onPointerDownCapture: noteShift, onMouseDownCapture: noteShift, onKeyDownCapture: noteShift, children: loading && !rows.length
|
package/dist/table/table.css
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
& tbody tr:last-child td { border-bottom: none; }
|
|
24
24
|
& tbody tr:hover { background: color-mix(in srgb, var(--ui-hover) 60%, transparent); }
|
|
25
25
|
& tbody tr[data-selected] { background: color-mix(in srgb, var(--ui-accent-soft) 45%, transparent); }
|
|
26
|
-
/*
|
|
27
|
-
[data-selecting] > & tbody tr { cursor: pointer; }
|
|
26
|
+
/* A click on a row opens it (`onRowClick`) or, while rows are ticked, ticks it. */
|
|
27
|
+
:is([data-clickable], [data-selecting]) > & tbody tr { cursor: pointer; }
|
|
28
28
|
/* Outer cells line up with a card's padding. */
|
|
29
29
|
[data-flush] > & :is(th, td):first-child { padding-left: 1.25rem; }
|
|
30
30
|
[data-flush] > & :is(th, td):last-child { padding-right: 1.25rem; } }
|