@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.d.cts CHANGED
@@ -70,7 +70,7 @@ declare function TeamStaffTable({ staff, loading, isError, interactive, onStaffC
70
70
 
71
71
  interface TeamRosterPlayer extends RosterPlayerLike {
72
72
  id: number;
73
- player_image_url: string | null;
73
+ player_image_url?: string | null;
74
74
  }
75
75
  interface TeamRosterTableProps {
76
76
  players: TeamRosterPlayer[];
@@ -91,10 +91,12 @@ interface TeamRosterTableProps {
91
91
  isSplitLayout?: boolean;
92
92
  /** True on a narrow/mobile viewport -- shrinks the Name column and its avatar. */
93
93
  isCompact?: boolean;
94
+ /** Name column width in px while `isCompact` (default 136, nukleus-app's; nukleus-clientapp used 120). */
95
+ compactNameColumnWidth?: number;
94
96
  resolveImageUrl?: EntityImageResolver;
95
97
  className?: string;
96
98
  }
97
- declare function TeamRosterTable({ players, leagueId, loading, isError, rowClickable, onPlayerClick, sortable, sorting, onSortingChange, virtualized, isSplitLayout, isCompact, resolveImageUrl, className, }: TeamRosterTableProps): react.JSX.Element;
99
+ declare function TeamRosterTable({ players, leagueId, loading, isError, rowClickable, onPlayerClick, sortable, sorting, onSortingChange, virtualized, isSplitLayout, isCompact, compactNameColumnWidth, resolveImageUrl, className, }: TeamRosterTableProps): react.JSX.Element;
98
100
 
99
101
  interface TeamPlacesCardProps {
100
102
  team: TeamInfoCardTeam;
package/dist/team.d.ts CHANGED
@@ -70,7 +70,7 @@ declare function TeamStaffTable({ staff, loading, isError, interactive, onStaffC
70
70
 
71
71
  interface TeamRosterPlayer extends RosterPlayerLike {
72
72
  id: number;
73
- player_image_url: string | null;
73
+ player_image_url?: string | null;
74
74
  }
75
75
  interface TeamRosterTableProps {
76
76
  players: TeamRosterPlayer[];
@@ -91,10 +91,12 @@ interface TeamRosterTableProps {
91
91
  isSplitLayout?: boolean;
92
92
  /** True on a narrow/mobile viewport -- shrinks the Name column and its avatar. */
93
93
  isCompact?: boolean;
94
+ /** Name column width in px while `isCompact` (default 136, nukleus-app's; nukleus-clientapp used 120). */
95
+ compactNameColumnWidth?: number;
94
96
  resolveImageUrl?: EntityImageResolver;
95
97
  className?: string;
96
98
  }
97
- declare function TeamRosterTable({ players, leagueId, loading, isError, rowClickable, onPlayerClick, sortable, sorting, onSortingChange, virtualized, isSplitLayout, isCompact, resolveImageUrl, className, }: TeamRosterTableProps): react.JSX.Element;
99
+ declare function TeamRosterTable({ players, leagueId, loading, isError, rowClickable, onPlayerClick, sortable, sorting, onSortingChange, virtualized, isSplitLayout, isCompact, compactNameColumnWidth, resolveImageUrl, className, }: TeamRosterTableProps): react.JSX.Element;
98
100
 
99
101
  interface TeamPlacesCardProps {
100
102
  team: TeamInfoCardTeam;
package/dist/team.js CHANGED
@@ -358,6 +358,7 @@ import {
358
358
  import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
359
359
  var DEFAULT_SORT2 = [{ id: "first_name", desc: false }];
360
360
  var NO_SORT = [];
361
+ var DEFAULT_COMPACT_NAME_COLUMN_WIDTH = 136;
361
362
  function cellSizeFor(key, isCompact) {
362
363
  switch (key) {
363
364
  case "first_name":
@@ -411,7 +412,7 @@ function RosterNameCell({
411
412
  ) : /* @__PURE__ */ jsx4("div", { className: "flex min-w-0 w-full items-center gap-2", children: content });
412
413
  }
413
414
  function splitGridCols(isCompact, isSplitLayout) {
414
- if (isCompact) return "!grid-cols-[minmax(136px,136px)_1fr]";
415
+ if (isCompact) return "!grid-cols-[minmax(var(--roster-name-col),var(--roster-name-col))_1fr]";
415
416
  return isSplitLayout ? "sm:!grid-cols-[minmax(220px,220px)_1fr]" : "";
416
417
  }
417
418
  function useRosterSorting({ sortable, sorting, onSortingChange }) {
@@ -491,6 +492,7 @@ function TeamRosterTable({
491
492
  virtualized = false,
492
493
  isSplitLayout = false,
493
494
  isCompact = false,
495
+ compactNameColumnWidth = DEFAULT_COMPACT_NAME_COLUMN_WIDTH,
494
496
  resolveImageUrl,
495
497
  className
496
498
  }) {
@@ -515,31 +517,38 @@ function TeamRosterTable({
515
517
  isCompact,
516
518
  resolveImageUrl
517
519
  });
518
- return /* @__PURE__ */ jsx4("div", { className: "w-full xl:flex xl:h-full xl:flex-1 xl:min-h-0 xl:flex-col xl:overflow-hidden", children: /* @__PURE__ */ jsx4(
519
- BaseTable2,
520
+ return /* @__PURE__ */ jsx4(
521
+ "div",
520
522
  {
521
- columns,
522
- data: displayedPlayers,
523
- getRowId: (row) => String(row.id),
524
- ...tableSortingProps,
525
- onRowClick: rowClickable ? (player) => onPlayerClick?.(player.id) : void 0,
526
- loading,
527
- emptyMessage: isError ? "Failed to load roster. Please try again." : "No roster found",
528
- pageSize: Math.max(displayedPlayers.length, 25),
529
- hidePagination: virtualized,
530
- stickyHeader: true,
531
- splitLayout: isSplitLayout,
532
- numberOfColumns: 1,
533
- splitLayoutGridCols: splitGridCols(isCompact, isSplitLayout),
534
- containerClassName: cn4("border-0 rounded-none xl:h-full", virtualized && "h-full"),
535
- className: cn4(
536
- "border-none xl:flex-1 xl:min-h-0 xl:overflow-hidden",
537
- virtualized && "h-full min-h-0 w-full",
538
- className
539
- ),
540
- bottomContent: virtualized && hasMore ? /* @__PURE__ */ jsx4("div", { ref: sentinelRef, className: "h-px w-full" }) : null
523
+ className: "w-full xl:flex xl:h-full xl:flex-1 xl:min-h-0 xl:flex-col xl:overflow-hidden",
524
+ style: { "--roster-name-col": `${compactNameColumnWidth}px` },
525
+ children: /* @__PURE__ */ jsx4(
526
+ BaseTable2,
527
+ {
528
+ columns,
529
+ data: displayedPlayers,
530
+ getRowId: (row) => String(row.id),
531
+ ...tableSortingProps,
532
+ onRowClick: rowClickable ? (player) => onPlayerClick?.(player.id) : void 0,
533
+ loading,
534
+ emptyMessage: isError ? "Failed to load roster. Please try again." : "No roster found",
535
+ pageSize: Math.max(displayedPlayers.length, 25),
536
+ hidePagination: virtualized,
537
+ stickyHeader: true,
538
+ splitLayout: isSplitLayout,
539
+ numberOfColumns: 1,
540
+ splitLayoutGridCols: splitGridCols(isCompact, isSplitLayout),
541
+ containerClassName: cn4("border-0 rounded-none xl:h-full", virtualized && "h-full"),
542
+ className: cn4(
543
+ "border-none xl:flex-1 xl:min-h-0 xl:overflow-hidden",
544
+ virtualized && "h-full min-h-0 w-full",
545
+ className
546
+ ),
547
+ bottomContent: virtualized && hasMore ? /* @__PURE__ */ jsx4("div", { ref: sentinelRef, className: "h-px w-full" }) : null
548
+ }
549
+ )
541
550
  }
542
- ) });
551
+ );
543
552
  }
544
553
 
545
554
  // src/team/team-places-card.tsx