@jinaan/uikit 0.1.49 → 0.1.51
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/data-table.d.ts.map +1 -1
- package/dist/index.js +203 -203
- package/dist/index.js.map +1 -1
- package/dist/table-empty-state.d.ts +4 -2
- package/dist/table-empty-state.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/data-table.tsx +18 -10
- package/src/table-empty-state.tsx +10 -12
|
@@ -7,8 +7,10 @@ interface TableEmptyStateProps {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Centered, contextual empty state for a table panel: an
|
|
11
|
-
*
|
|
10
|
+
* Centered, contextual empty state for a table panel: an icon chip, a compact
|
|
11
|
+
* heading, supporting text, and an optional action. Typography matches the
|
|
12
|
+
* onboarding empty cards (e.g. the MCP servers card) so tables never shout
|
|
13
|
+
* louder than the surrounding surface.
|
|
12
14
|
*/
|
|
13
15
|
export declare function TableEmptyState({ icon, title, description, action, className, }: TableEmptyStateProps): import("react").JSX.Element;
|
|
14
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-empty-state.d.ts","sourceRoot":"","sources":["../src/table-empty-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED
|
|
1
|
+
{"version":3,"file":"table-empty-state.d.ts","sourceRoot":"","sources":["../src/table-empty-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,GACV,EAAE,oBAAoB,+BAwBtB"}
|
package/package.json
CHANGED
package/src/data-table.tsx
CHANGED
|
@@ -441,16 +441,7 @@ export function DataTable<T>({
|
|
|
441
441
|
useLayoutEffect(() => {
|
|
442
442
|
const table = bodyTableRef.current;
|
|
443
443
|
if (!table) return;
|
|
444
|
-
|
|
445
|
-
// Column set or row content changed: drop the pinned widths so the body
|
|
446
|
-
// re-renders content-sized (table-auto) and the next pass measures
|
|
447
|
-
// intrinsic widths again. Without this, the effect would measure the
|
|
448
|
-
// stale colgroup's shifted layout and pin the wrong (truncating) widths.
|
|
449
|
-
structureRef.current = structureKey;
|
|
450
|
-
contentRef.current = contentKey;
|
|
451
|
-
setColumnWidths((prev) => (prev.length === 0 ? prev : []));
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
444
|
+
|
|
454
445
|
const measure = () => {
|
|
455
446
|
const cells = table.tBodies[0]?.rows.item(0)?.cells;
|
|
456
447
|
if (!cells || cells.length === 0) {
|
|
@@ -481,6 +472,23 @@ export function DataTable<T>({
|
|
|
481
472
|
prev.length === widths.length && prev.every((w, i) => w === widths[i]) ? prev : widths,
|
|
482
473
|
);
|
|
483
474
|
};
|
|
475
|
+
if (structureRef.current !== structureKey || contentRef.current !== contentKey) {
|
|
476
|
+
// Column set or row content changed: drop the pinned widths so the body
|
|
477
|
+
// re-renders content-sized (table-auto) and the next pass measures
|
|
478
|
+
// intrinsic widths again. Without this, the effect would measure the
|
|
479
|
+
// stale colgroup's shifted layout and pin the wrong (truncating) widths.
|
|
480
|
+
structureRef.current = structureKey;
|
|
481
|
+
contentRef.current = contentKey;
|
|
482
|
+
if (pinned) {
|
|
483
|
+
// The widths -> [] state flip re-runs this effect (see `pinned` in the
|
|
484
|
+
// deps); measuring now would read the still-pinned layout.
|
|
485
|
+
setColumnWidths([]);
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
// Already unpinned: no state flip would re-run the effect, so measure
|
|
489
|
+
// the content-sized layout right away.
|
|
490
|
+
}
|
|
491
|
+
|
|
484
492
|
measure();
|
|
485
493
|
syncBandScroll();
|
|
486
494
|
if (typeof ResizeObserver === "undefined") return;
|
|
@@ -11,8 +11,10 @@ interface TableEmptyStateProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Centered, contextual empty state for a table panel: an
|
|
15
|
-
*
|
|
14
|
+
* Centered, contextual empty state for a table panel: an icon chip, a compact
|
|
15
|
+
* heading, supporting text, and an optional action. Typography matches the
|
|
16
|
+
* onboarding empty cards (e.g. the MCP servers card) so tables never shout
|
|
17
|
+
* louder than the surrounding surface.
|
|
16
18
|
*/
|
|
17
19
|
export function TableEmptyState({
|
|
18
20
|
icon,
|
|
@@ -24,28 +26,24 @@ export function TableEmptyState({
|
|
|
24
26
|
return (
|
|
25
27
|
<div
|
|
26
28
|
className={cn(
|
|
27
|
-
"flex
|
|
29
|
+
"flex flex-col items-center justify-center gap-4 px-6 py-12 text-center",
|
|
28
30
|
className,
|
|
29
31
|
)}
|
|
30
32
|
>
|
|
31
33
|
{icon ? (
|
|
32
|
-
<div className="flex size-
|
|
34
|
+
<div className="flex size-12 items-center justify-center rounded-xl border border-line bg-elevated text-subtle [&_svg]:size-5">
|
|
33
35
|
{icon}
|
|
34
36
|
</div>
|
|
35
37
|
) : null}
|
|
36
|
-
<div className="space-y-
|
|
37
|
-
<p className="text-
|
|
38
|
-
{title}
|
|
39
|
-
</p>
|
|
38
|
+
<div className="space-y-1">
|
|
39
|
+
<p className="text-base font-medium text-table-header-active">{title}</p>
|
|
40
40
|
{description ? (
|
|
41
|
-
<p className="mx-auto max-w-md text-
|
|
41
|
+
<p className="mx-auto max-w-md text-[13px] leading-5 text-table-muted">
|
|
42
42
|
{description}
|
|
43
43
|
</p>
|
|
44
44
|
) : null}
|
|
45
45
|
</div>
|
|
46
|
-
{action ?
|
|
47
|
-
<div className="text-sm font-medium text-table-accent">{action}</div>
|
|
48
|
-
) : null}
|
|
46
|
+
{action ? <div className="text-table-accent">{action}</div> : null}
|
|
49
47
|
</div>
|
|
50
48
|
);
|
|
51
49
|
}
|