@nukleus-sports/ui-patterns 0.8.0 → 0.9.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.
- package/dist/team.cjs +33 -24
- package/dist/team.cjs.map +1 -1
- package/dist/team.d.cts +4 -2
- package/dist/team.d.ts +4 -2
- package/dist/team.js +33 -24
- package/dist/team.js.map +1 -1
- package/package.json +2 -2
package/dist/team.cjs
CHANGED
|
@@ -607,6 +607,7 @@ var import_core4 = require("@nukleus-sports/core");
|
|
|
607
607
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
608
608
|
var DEFAULT_SORT2 = [{ id: "first_name", desc: false }];
|
|
609
609
|
var NO_SORT = [];
|
|
610
|
+
var DEFAULT_COMPACT_NAME_COLUMN_WIDTH = 136;
|
|
610
611
|
function cellSizeFor(key, isCompact) {
|
|
611
612
|
switch (key) {
|
|
612
613
|
case "first_name":
|
|
@@ -660,7 +661,7 @@ function RosterNameCell({
|
|
|
660
661
|
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex min-w-0 w-full items-center gap-2", children: content });
|
|
661
662
|
}
|
|
662
663
|
function splitGridCols(isCompact, isSplitLayout) {
|
|
663
|
-
if (isCompact) return "!grid-cols-[minmax(
|
|
664
|
+
if (isCompact) return "!grid-cols-[minmax(var(--roster-name-col),var(--roster-name-col))_1fr]";
|
|
664
665
|
return isSplitLayout ? "sm:!grid-cols-[minmax(220px,220px)_1fr]" : "";
|
|
665
666
|
}
|
|
666
667
|
function useRosterSorting({ sortable, sorting, onSortingChange }) {
|
|
@@ -740,6 +741,7 @@ function TeamRosterTable({
|
|
|
740
741
|
virtualized = false,
|
|
741
742
|
isSplitLayout = false,
|
|
742
743
|
isCompact = false,
|
|
744
|
+
compactNameColumnWidth = DEFAULT_COMPACT_NAME_COLUMN_WIDTH,
|
|
743
745
|
resolveImageUrl,
|
|
744
746
|
className
|
|
745
747
|
}) {
|
|
@@ -764,31 +766,38 @@ function TeamRosterTable({
|
|
|
764
766
|
isCompact,
|
|
765
767
|
resolveImageUrl
|
|
766
768
|
});
|
|
767
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
768
|
-
|
|
769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
770
|
+
"div",
|
|
769
771
|
{
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
772
|
+
className: "w-full xl:flex xl:h-full xl:flex-1 xl:min-h-0 xl:flex-col xl:overflow-hidden",
|
|
773
|
+
style: { "--roster-name-col": `${compactNameColumnWidth}px` },
|
|
774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
775
|
+
import_ui_web5.BaseTable,
|
|
776
|
+
{
|
|
777
|
+
columns,
|
|
778
|
+
data: displayedPlayers,
|
|
779
|
+
getRowId: (row) => String(row.id),
|
|
780
|
+
...tableSortingProps,
|
|
781
|
+
onRowClick: rowClickable ? (player) => onPlayerClick?.(player.id) : void 0,
|
|
782
|
+
loading,
|
|
783
|
+
emptyMessage: isError ? "Failed to load roster. Please try again." : "No roster found",
|
|
784
|
+
pageSize: Math.max(displayedPlayers.length, 25),
|
|
785
|
+
hidePagination: virtualized,
|
|
786
|
+
stickyHeader: true,
|
|
787
|
+
splitLayout: isSplitLayout,
|
|
788
|
+
numberOfColumns: 1,
|
|
789
|
+
splitLayoutGridCols: splitGridCols(isCompact, isSplitLayout),
|
|
790
|
+
containerClassName: (0, import_ui_web5.cn)("border-0 rounded-none xl:h-full", virtualized && "h-full"),
|
|
791
|
+
className: (0, import_ui_web5.cn)(
|
|
792
|
+
"border-none xl:flex-1 xl:min-h-0 xl:overflow-hidden",
|
|
793
|
+
virtualized && "h-full min-h-0 w-full",
|
|
794
|
+
className
|
|
795
|
+
),
|
|
796
|
+
bottomContent: virtualized && hasMore ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: sentinelRef, className: "h-px w-full" }) : null
|
|
797
|
+
}
|
|
798
|
+
)
|
|
790
799
|
}
|
|
791
|
-
)
|
|
800
|
+
);
|
|
792
801
|
}
|
|
793
802
|
|
|
794
803
|
// src/team/team-places-card.tsx
|