@sensiblestats/widget-react 0.29.5 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9d0b409: Replace the pre-match fixture card's W/D/L letter pills with a two-column "Team form" card: each of the last five results renders as a coloured scoreline card (subject crest, score, opponent crest), oriented by which side the team played on. `FixtureCardData.homeForm`/`awayForm` change from `string[]` to a new `FormMatch[]` shape (`result`, `teamScore`, `oppScore`, `teamIsHome`, `opponentCrestUrl`).
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [9d0b409]
12
+ - @sensiblestats/widget-sdk@0.26.0
13
+
3
14
  ## 0.29.5
4
15
 
5
16
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1460,24 +1460,28 @@ function GreetingDashboard({ dashboard, onTap }) {
1460
1460
 
1461
1461
  // src/components/dashboard/FixtureCard.tsx
1462
1462
  var import_jsx_runtime17 = require("react/jsx-runtime");
1463
- function resultClass(result) {
1464
- const upper = result.toUpperCase();
1465
- if (upper === "W") return "ss-w-fandash-form-pill--win";
1466
- if (upper === "L") return "ss-w-fandash-form-pill--loss";
1467
- return "ss-w-fandash-form-pill--draw";
1468
- }
1469
- function FormStrip({ form }) {
1470
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-form", children: form.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: `ss-w-fandash-form-pill ${resultClass(r)}`, children: r }, `${r}-${i}`)) });
1471
- }
1472
- function FormRow({ name, form, crestUrl }) {
1473
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-fandash-formrow", children: [
1474
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "ss-w-fandash-formrow-team", children: [
1475
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Crest2, { url: crestUrl ?? void 0, name, kind: "team" }),
1476
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-formrow-name", children: name })
1477
- ] }),
1478
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormStrip, { form })
1463
+ function teamFormResultClass(result) {
1464
+ if (result === "W") return "ss-w-fandash-teamform-cell--win";
1465
+ if (result === "L") return "ss-w-fandash-teamform-cell--loss";
1466
+ return "ss-w-fandash-teamform-cell--draw";
1467
+ }
1468
+ function TeamFormCell({ m, subjectCrestUrl, subjectName }) {
1469
+ const subjectCrest = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Crest2, { url: subjectCrestUrl ?? void 0, name: subjectName, kind: "team" });
1470
+ const opponentCrest = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Crest2, { url: m.opponentCrestUrl ?? void 0, kind: "team" });
1471
+ const score = m.teamIsHome ? `${m.teamScore} - ${m.oppScore}` : `${m.oppScore} - ${m.teamScore}`;
1472
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `ss-w-fandash-teamform-cell ${teamFormResultClass(m.result)}`, children: [
1473
+ m.teamIsHome ? subjectCrest : opponentCrest,
1474
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-teamform-score", children: score }),
1475
+ m.teamIsHome ? opponentCrest : subjectCrest
1479
1476
  ] });
1480
1477
  }
1478
+ var TEAM_FORM_ROWS = 5;
1479
+ function teamFormRows(data) {
1480
+ return Array.from({ length: TEAM_FORM_ROWS }, (_, i) => i).flatMap((i) => [
1481
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-teamform-slot", children: data.homeForm[i] ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TeamFormCell, { m: data.homeForm[i], subjectCrestUrl: data.homeCrestUrl, subjectName: data.homeName }) : null }, `h-${i}`),
1482
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-teamform-slot", children: data.awayForm[i] ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TeamFormCell, { m: data.awayForm[i], subjectCrestUrl: data.awayCrestUrl, subjectName: data.awayName }) : null }, `a-${i}`)
1483
+ ]);
1484
+ }
1481
1485
  function FixtureCard({ card }) {
1482
1486
  const { data } = card;
1483
1487
  const h2h = data.h2H;
@@ -1509,10 +1513,17 @@ function FixtureCard({ card }) {
1509
1513
  ] }),
1510
1514
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-fandash-card ss-w-fandash-lastfive", children: [
1511
1515
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-eyebrow", children: data.formLabel }),
1512
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-fandash-fixture-form", children: [
1513
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormRow, { name: data.homeName, form: data.homeForm, crestUrl: data.homeCrestUrl }),
1514
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FormRow, { name: data.awayName, form: data.awayForm, crestUrl: data.awayCrestUrl })
1515
- ] })
1516
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-fandash-teamform-head", children: [
1517
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "ss-w-fandash-teamform-head-team", children: [
1518
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Crest2, { url: data.homeCrestUrl ?? void 0, name: data.homeName, kind: "team" }),
1519
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-teamform-head-name", children: data.homeName })
1520
+ ] }),
1521
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "ss-w-fandash-teamform-head-team", children: [
1522
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Crest2, { url: data.awayCrestUrl ?? void 0, name: data.awayName, kind: "team" }),
1523
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-fandash-teamform-head-name", children: data.awayName })
1524
+ ] })
1525
+ ] }),
1526
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ss-w-fandash-teamform-rows", children: teamFormRows(data) })
1516
1527
  ] }),
1517
1528
  h2h || data.fact ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-fandash-card ss-w-fandash-h2h", children: [
1518
1529
  h2h ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
@@ -1902,7 +1913,7 @@ function RestingSeasonCard({ card, onTap }) {
1902
1913
 
1903
1914
  // src/components/dashboard/RestingFormCard.tsx
1904
1915
  var import_jsx_runtime33 = require("react/jsx-runtime");
1905
- function resultClass2(result) {
1916
+ function resultClass(result) {
1906
1917
  const upper = result.toUpperCase();
1907
1918
  if (upper === "W") return "ss-w-fandash-form-pill--win";
1908
1919
  if (upper === "L") return "ss-w-fandash-form-pill--loss";
@@ -1912,7 +1923,7 @@ function RestingFormCard({ card }) {
1912
1923
  const { data } = card;
1913
1924
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "ss-w-fandash-card ss-w-fandash-resting-form", children: [
1914
1925
  card.title ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
1915
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-fandash-form", children: data.letters.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `ss-w-fandash-form-pill ${resultClass2(r)}`, children: r }, `${r}-${i}`)) })
1926
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-fandash-form", children: data.letters.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `ss-w-fandash-form-pill ${resultClass(r)}`, children: r }, `${r}-${i}`)) })
1916
1927
  ] });
1917
1928
  }
1918
1929
 
@@ -2801,13 +2812,25 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
2801
2812
  /* extra breathing room between the tally row and the fact beyond the card's own gap */
2802
2813
  .ss-w-fandash-h2h .ss-w-fandash-fact { margin-top: 4px; }
2803
2814
 
2804
- /* last-five: one row per side, team name left, form pills right */
2805
- .ss-w-fandash-fixture-form { display: flex; flex-direction: column; gap: 5px; }
2806
- .ss-w-fandash-formrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
2807
- .ss-w-fandash-formrow-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
2808
- .ss-w-fandash-formrow-team .ss-w-bi-crest { width: 20px; height: 20px; }
2809
- .ss-w-fandash-formrow-team .ss-w-bi-crest-mono { font-size: 9px; }
2810
- .ss-w-fandash-formrow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
2815
+ /* Team form: a two-column result-card grid, left = home team's last 5, right = away team's last 5,
2816
+ most-recent first. The head row carries each column's crest + name; the rows grid is filled
2817
+ home-cell/away-cell per index so the 2-col grid lays out pairs without extra JS bookkeeping. */
2818
+ .ss-w-fandash-teamform-head { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
2819
+ .ss-w-fandash-teamform-head-team { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; font-weight: 750; }
2820
+ .ss-w-fandash-teamform-head-team .ss-w-bi-crest { width: 18px; height: 18px; }
2821
+ .ss-w-fandash-teamform-head-team .ss-w-bi-crest-mono { font-size: 8px; }
2822
+ .ss-w-fandash-teamform-head-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2823
+ .ss-w-fandash-teamform-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 6px; }
2824
+ .ss-w-fandash-teamform-slot { display: block; min-width: 0; }
2825
+ .ss-w-fandash-teamform-cell {
2826
+ display: flex; align-items: center; gap: 4px; border-radius: 7px; padding: 4px 5px; color: #fff;
2827
+ }
2828
+ .ss-w-fandash-teamform-cell--win { background: var(--ss-w-pos); }
2829
+ .ss-w-fandash-teamform-cell--loss { background: var(--ss-w-neg); }
2830
+ .ss-w-fandash-teamform-cell--draw { background: var(--ss-w-faint); }
2831
+ .ss-w-fandash-teamform-cell .ss-w-bi-crest { width: 16px; height: 16px; flex: none; background: rgba(255, 255, 255, .22); }
2832
+ .ss-w-fandash-teamform-cell .ss-w-bi-crest-mono { font-size: 7px; color: #fff; }
2833
+ .ss-w-fandash-teamform-score { flex: 1; text-align: center; font-size: 12.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
2811
2834
  .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; }
2812
2835
  .ss-w-fandash-injuries-more:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
2813
2836
  .ss-w-fandash-form { display: inline-flex; gap: 3px; flex: none; }