@sensiblestats/widget-react 0.29.4 → 0.30.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/index.js CHANGED
@@ -1423,24 +1423,28 @@ function GreetingDashboard({ dashboard, onTap }) {
1423
1423
 
1424
1424
  // src/components/dashboard/FixtureCard.tsx
1425
1425
  import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1426
- function resultClass(result) {
1427
- const upper = result.toUpperCase();
1428
- if (upper === "W") return "ss-w-fandash-form-pill--win";
1429
- if (upper === "L") return "ss-w-fandash-form-pill--loss";
1430
- return "ss-w-fandash-form-pill--draw";
1431
- }
1432
- function FormStrip({ form }) {
1433
- return /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-form", children: form.map((r, i) => /* @__PURE__ */ jsx17("span", { className: `ss-w-fandash-form-pill ${resultClass(r)}`, children: r }, `${r}-${i}`)) });
1434
- }
1435
- function FormRow({ name, form, crestUrl }) {
1436
- return /* @__PURE__ */ jsxs13("div", { className: "ss-w-fandash-formrow", children: [
1437
- /* @__PURE__ */ jsxs13("span", { className: "ss-w-fandash-formrow-team", children: [
1438
- /* @__PURE__ */ jsx17(Crest2, { url: crestUrl ?? void 0, name, kind: "team" }),
1439
- /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-formrow-name", children: name })
1440
- ] }),
1441
- /* @__PURE__ */ jsx17(FormStrip, { form })
1426
+ function teamFormResultClass(result) {
1427
+ if (result === "W") return "ss-w-fandash-teamform-cell--win";
1428
+ if (result === "L") return "ss-w-fandash-teamform-cell--loss";
1429
+ return "ss-w-fandash-teamform-cell--draw";
1430
+ }
1431
+ function TeamFormCell({ m, subjectCrestUrl, subjectName }) {
1432
+ const subjectCrest = /* @__PURE__ */ jsx17(Crest2, { url: subjectCrestUrl ?? void 0, name: subjectName, kind: "team" });
1433
+ const opponentCrest = /* @__PURE__ */ jsx17(Crest2, { url: m.opponentCrestUrl ?? void 0, kind: "team" });
1434
+ const score = m.teamIsHome ? `${m.teamScore} - ${m.oppScore}` : `${m.oppScore} - ${m.teamScore}`;
1435
+ return /* @__PURE__ */ jsxs13("div", { className: `ss-w-fandash-teamform-cell ${teamFormResultClass(m.result)}`, children: [
1436
+ m.teamIsHome ? subjectCrest : opponentCrest,
1437
+ /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-teamform-score", children: score }),
1438
+ m.teamIsHome ? opponentCrest : subjectCrest
1442
1439
  ] });
1443
1440
  }
1441
+ var TEAM_FORM_ROWS = 5;
1442
+ function teamFormRows(data) {
1443
+ return Array.from({ length: TEAM_FORM_ROWS }, (_, i) => i).flatMap((i) => [
1444
+ /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-teamform-slot", children: data.homeForm[i] ? /* @__PURE__ */ jsx17(TeamFormCell, { m: data.homeForm[i], subjectCrestUrl: data.homeCrestUrl, subjectName: data.homeName }) : null }, `h-${i}`),
1445
+ /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-teamform-slot", children: data.awayForm[i] ? /* @__PURE__ */ jsx17(TeamFormCell, { m: data.awayForm[i], subjectCrestUrl: data.awayCrestUrl, subjectName: data.awayName }) : null }, `a-${i}`)
1446
+ ]);
1447
+ }
1444
1448
  function FixtureCard({ card }) {
1445
1449
  const { data } = card;
1446
1450
  const h2h = data.h2H;
@@ -1472,10 +1476,17 @@ function FixtureCard({ card }) {
1472
1476
  ] }),
1473
1477
  /* @__PURE__ */ jsxs13("div", { className: "ss-w-fandash-card ss-w-fandash-lastfive", children: [
1474
1478
  /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-eyebrow", children: data.formLabel }),
1475
- /* @__PURE__ */ jsxs13("div", { className: "ss-w-fandash-fixture-form", children: [
1476
- /* @__PURE__ */ jsx17(FormRow, { name: data.homeName, form: data.homeForm, crestUrl: data.homeCrestUrl }),
1477
- /* @__PURE__ */ jsx17(FormRow, { name: data.awayName, form: data.awayForm, crestUrl: data.awayCrestUrl })
1478
- ] })
1479
+ /* @__PURE__ */ jsxs13("div", { className: "ss-w-fandash-teamform-head", children: [
1480
+ /* @__PURE__ */ jsxs13("span", { className: "ss-w-fandash-teamform-head-team", children: [
1481
+ /* @__PURE__ */ jsx17(Crest2, { url: data.homeCrestUrl ?? void 0, name: data.homeName, kind: "team" }),
1482
+ /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-teamform-head-name", children: data.homeName })
1483
+ ] }),
1484
+ /* @__PURE__ */ jsxs13("span", { className: "ss-w-fandash-teamform-head-team", children: [
1485
+ /* @__PURE__ */ jsx17(Crest2, { url: data.awayCrestUrl ?? void 0, name: data.awayName, kind: "team" }),
1486
+ /* @__PURE__ */ jsx17("span", { className: "ss-w-fandash-teamform-head-name", children: data.awayName })
1487
+ ] })
1488
+ ] }),
1489
+ /* @__PURE__ */ jsx17("div", { className: "ss-w-fandash-teamform-rows", children: teamFormRows(data) })
1479
1490
  ] }),
1480
1491
  h2h || data.fact ? /* @__PURE__ */ jsxs13("div", { className: "ss-w-fandash-card ss-w-fandash-h2h", children: [
1481
1492
  h2h ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
@@ -1865,7 +1876,7 @@ function RestingSeasonCard({ card, onTap }) {
1865
1876
 
1866
1877
  // src/components/dashboard/RestingFormCard.tsx
1867
1878
  import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
1868
- function resultClass2(result) {
1879
+ function resultClass(result) {
1869
1880
  const upper = result.toUpperCase();
1870
1881
  if (upper === "W") return "ss-w-fandash-form-pill--win";
1871
1882
  if (upper === "L") return "ss-w-fandash-form-pill--loss";
@@ -1875,7 +1886,7 @@ function RestingFormCard({ card }) {
1875
1886
  const { data } = card;
1876
1887
  return /* @__PURE__ */ jsxs29("div", { className: "ss-w-fandash-card ss-w-fandash-resting-form", children: [
1877
1888
  card.title ? /* @__PURE__ */ jsx33("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
1878
- /* @__PURE__ */ jsx33("span", { className: "ss-w-fandash-form", children: data.letters.map((r, i) => /* @__PURE__ */ jsx33("span", { className: `ss-w-fandash-form-pill ${resultClass2(r)}`, children: r }, `${r}-${i}`)) })
1889
+ /* @__PURE__ */ jsx33("span", { className: "ss-w-fandash-form", children: data.letters.map((r, i) => /* @__PURE__ */ jsx33("span", { className: `ss-w-fandash-form-pill ${resultClass(r)}`, children: r }, `${r}-${i}`)) })
1879
1890
  ] });
1880
1891
  }
1881
1892
 
@@ -2764,13 +2775,25 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
2764
2775
  /* extra breathing room between the tally row and the fact beyond the card's own gap */
2765
2776
  .ss-w-fandash-h2h .ss-w-fandash-fact { margin-top: 4px; }
2766
2777
 
2767
- /* last-five: one row per side, team name left, form pills right */
2768
- .ss-w-fandash-fixture-form { display: flex; flex-direction: column; gap: 5px; }
2769
- .ss-w-fandash-formrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
2770
- .ss-w-fandash-formrow-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
2771
- .ss-w-fandash-formrow-team .ss-w-bi-crest { width: 20px; height: 20px; }
2772
- .ss-w-fandash-formrow-team .ss-w-bi-crest-mono { font-size: 9px; }
2773
- .ss-w-fandash-formrow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
2778
+ /* Team form: a two-column result-card grid, left = home team's last 5, right = away team's last 5,
2779
+ most-recent first. The head row carries each column's crest + name; the rows grid is filled
2780
+ home-cell/away-cell per index so the 2-col grid lays out pairs without extra JS bookkeeping. */
2781
+ .ss-w-fandash-teamform-head { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
2782
+ .ss-w-fandash-teamform-head-team { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; font-weight: 750; }
2783
+ .ss-w-fandash-teamform-head-team .ss-w-bi-crest { width: 18px; height: 18px; }
2784
+ .ss-w-fandash-teamform-head-team .ss-w-bi-crest-mono { font-size: 8px; }
2785
+ .ss-w-fandash-teamform-head-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2786
+ .ss-w-fandash-teamform-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 6px; }
2787
+ .ss-w-fandash-teamform-slot { display: block; min-width: 0; }
2788
+ .ss-w-fandash-teamform-cell {
2789
+ display: flex; align-items: center; gap: 4px; border-radius: 7px; padding: 4px 5px; color: #fff;
2790
+ }
2791
+ .ss-w-fandash-teamform-cell--win { background: var(--ss-w-pos); }
2792
+ .ss-w-fandash-teamform-cell--loss { background: var(--ss-w-neg); }
2793
+ .ss-w-fandash-teamform-cell--draw { background: var(--ss-w-faint); }
2794
+ .ss-w-fandash-teamform-cell .ss-w-bi-crest { width: 16px; height: 16px; flex: none; background: rgba(255, 255, 255, .22); }
2795
+ .ss-w-fandash-teamform-cell .ss-w-bi-crest-mono { font-size: 7px; color: #fff; }
2796
+ .ss-w-fandash-teamform-score { flex: 1; text-align: center; font-size: 12.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
2774
2797
  .ss-w-fandash-injuries-more { margin-top: 10px; width: 100%; background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); border-radius: 9px; padding: 7px; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--ss-w-accent); cursor: pointer; }
2775
2798
  .ss-w-fandash-injuries-more:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
2776
2799
  .ss-w-fandash-form { display: inline-flex; gap: 3px; flex: none; }