@sensiblestats/widget-react 0.66.0 → 0.66.1
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 +6 -0
- package/dist/index.cjs +29 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +142 -123
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.66.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Match odds card polish: a compact list price with Add to slip off has a name screen readers read, and the 1 X 2 heads are hidden from them; "Show more" moves focus to the first new row; a list price already in the slip shows a tick; the Odds tab never draws a card stat.
|
|
8
|
+
|
|
3
9
|
## 0.66.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1480,8 +1480,9 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
1480
1480
|
disabled: pending || settled,
|
|
1481
1481
|
onClick,
|
|
1482
1482
|
children: [
|
|
1483
|
+
settled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-mol-tick", "aria-hidden": "true", children: "\u2713" }) : null,
|
|
1483
1484
|
price.label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-mol-lab", children: price.label }) : null,
|
|
1484
|
-
shownOdds
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: shownOdds })
|
|
1485
1486
|
]
|
|
1486
1487
|
}
|
|
1487
1488
|
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -1951,7 +1952,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
1951
1952
|
vm.market ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mo-market-row", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-mo-market", children: vm.market }) }) : null
|
|
1952
1953
|
] }) : null
|
|
1953
1954
|
] }),
|
|
1954
|
-
vm.statText && !hideHeader ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mo-stat", children: vm.statText }) : null,
|
|
1955
|
+
vm.statText && !hideHeader && !pinRef ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mo-stat", children: vm.statText }) : null,
|
|
1955
1956
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-mo-rows", children: [
|
|
1956
1957
|
vm.mainRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(OddsRow, { vm, row, ui, slip, inSlipIds, history }, row.key)),
|
|
1957
1958
|
open ? vm.moreRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(OddsRow, { vm, row, ui, slip, inSlipIds, history }, row.key)) : null
|
|
@@ -2032,6 +2033,7 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
|
2032
2033
|
function Cell({ row, cell, ui, slip }) {
|
|
2033
2034
|
const vm = row.card;
|
|
2034
2035
|
const selection = vm.addToSlipEnabled ? marketOddsRowToSlipSelection(vm, cell.row, slip.conversationId) : null;
|
|
2036
|
+
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell.row.selection} ${cell.row.odds}`;
|
|
2035
2037
|
const button = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2036
2038
|
SlipButton,
|
|
2037
2039
|
{
|
|
@@ -2042,7 +2044,7 @@ function Cell({ row, cell, ui, slip }) {
|
|
|
2042
2044
|
line: cell.row.line,
|
|
2043
2045
|
slip,
|
|
2044
2046
|
ui,
|
|
2045
|
-
price: { label: cell.label, ariaLabel:
|
|
2047
|
+
price: { label: cell.label, ariaLabel: name }
|
|
2046
2048
|
}
|
|
2047
2049
|
);
|
|
2048
2050
|
return (
|
|
@@ -2050,18 +2052,19 @@ function Cell({ row, cell, ui, slip }) {
|
|
|
2050
2052
|
// and 101.00 two.
|
|
2051
2053
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: ["ss-w-mol-cell", cell.row.odds.length >= 5 && "ss-w-mol-cell--wide", cell.row.odds.length >= 6 && "ss-w-mol-cell--wider"].filter(Boolean).join(" "), children: [
|
|
2052
2054
|
selection && slip.onAddToSlip && ui ? button : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "ss-w-mol-price", children: [
|
|
2053
|
-
cell.label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-lab", children: cell.label }) : null,
|
|
2054
|
-
cell.row.odds
|
|
2055
|
+
cell.label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-lab", "aria-hidden": "true", children: cell.label }) : null,
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: cell.row.odds }),
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-vh", children: name })
|
|
2055
2058
|
] }),
|
|
2056
2059
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OddsMovementBadge, { previous: cell.row.previousOdds, current: cell.row.odds, direction: cell.row.movementDirection, ui })
|
|
2057
2060
|
] })
|
|
2058
2061
|
);
|
|
2059
2062
|
}
|
|
2060
|
-
function Row({ row, columns, ui, slip, monitor }) {
|
|
2063
|
+
function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
2061
2064
|
const vm = row.card;
|
|
2062
2065
|
const kickoffFallback = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
2063
2066
|
const when = vm.isLive ? ui?.liveLabel ?? "Live" : vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
2064
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol-row", children: [
|
|
2067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol-row", ref: rowRef, tabIndex: rowRef ? -1 : void 0, children: [
|
|
2065
2068
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(MatchLink, { as: "div", matchId: vm.matchId, home: vm.homeTeamName, away: vm.awayTeamName, className: "ss-w-mol-fx", children: [
|
|
2066
2069
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "ss-w-mol-team", children: [
|
|
2067
2070
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Crest2, { kind: "team", url: vm.homeCrest, name: vm.homeTeamName ?? "" }),
|
|
@@ -2083,11 +2086,17 @@ function Row({ row, columns, ui, slip, monitor }) {
|
|
|
2083
2086
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
2084
2087
|
const [shown, setShown] = (0, import_react13.useState)(COMPACT_PAGE);
|
|
2085
2088
|
const hidden = list.rowCount - shown;
|
|
2089
|
+
const [focusIndex, setFocusIndex] = (0, import_react13.useState)(null);
|
|
2090
|
+
const focusRef = (0, import_react13.useRef)(null);
|
|
2091
|
+
(0, import_react13.useEffect)(() => {
|
|
2092
|
+
if (focusIndex !== null) focusRef.current?.focus();
|
|
2093
|
+
}, [focusIndex]);
|
|
2086
2094
|
let left = shown;
|
|
2095
|
+
let index = 0;
|
|
2087
2096
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol", children: [
|
|
2088
2097
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol-head", children: [
|
|
2089
2098
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-market", children: list.market }),
|
|
2090
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-cols", style: { gridTemplateColumns: `repeat(${list.columns.length}, minmax(0, 1fr))` }, children: list.columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-col", children: c }, `${c}:${i}`)) }),
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-cols", "aria-hidden": "true", style: { gridTemplateColumns: `repeat(${list.columns.length}, minmax(0, 1fr))` }, children: list.columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-col", children: c }, `${c}:${i}`)) }),
|
|
2091
2100
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-side", "aria-hidden": "true" })
|
|
2092
2101
|
] }),
|
|
2093
2102
|
list.groups.map((group, gi) => {
|
|
@@ -2099,10 +2108,16 @@ function CompactOddsList({ list, ui, slip, monitor }) {
|
|
|
2099
2108
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Crest2, { kind: "comp", url: group.competitionCrest, name: group.competition }),
|
|
2100
2109
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: group.competition })
|
|
2101
2110
|
] }) : null,
|
|
2102
|
-
rows.map((row) =>
|
|
2111
|
+
rows.map((row) => {
|
|
2112
|
+
const at = index++;
|
|
2113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Row, { row, columns: list.columns.length, ui, slip, monitor, rowRef: at === focusIndex ? focusRef : void 0 }, row.card.id);
|
|
2114
|
+
})
|
|
2103
2115
|
] }, `${group.competition ?? ""}:${gi}`);
|
|
2104
2116
|
}),
|
|
2105
|
-
hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "ss-w-mo-more", onClick: () =>
|
|
2117
|
+
hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "ss-w-mo-more", onClick: () => {
|
|
2118
|
+
setFocusIndex(shown);
|
|
2119
|
+
setShown((n) => n + COMPACT_PAGE);
|
|
2120
|
+
}, children: [
|
|
2106
2121
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: ui?.showMore ? ui.showMore(Math.min(COMPACT_PAGE, hidden)) : `Show ${Math.min(COMPACT_PAGE, hidden)} more` }),
|
|
2107
2122
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mo-more-chev", "aria-hidden": "true" })
|
|
2108
2123
|
] }) : null,
|
|
@@ -8601,6 +8616,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
8601
8616
|
.ss-w-mol-col { font-size: 10px; font-weight: 700; color: var(--ss-w-faint); text-align: center; overflow-wrap: break-word; min-width: 0; }
|
|
8602
8617
|
.ss-w-mol-comp { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-w-faint); padding-top: 4px; }
|
|
8603
8618
|
.ss-w-mol-row { padding: 6px 0; border-bottom: 1px dashed var(--ss-w-line); min-height: 48px; box-sizing: border-box; }
|
|
8619
|
+
.ss-w-mol-row:focus { outline: none; }
|
|
8620
|
+
.ss-w-mol-row:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; border-radius: 6px; }
|
|
8621
|
+
.ss-w-mol-tick { font-family: inherit; font-size: 9.5px; font-weight: 700; line-height: 1.1; }
|
|
8622
|
+
.ss-w-vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
8604
8623
|
.ss-w-mol-group .ss-w-mol-row:last-child { border-bottom: none; }
|
|
8605
8624
|
.ss-w-mol-fx { display: flex; flex-direction: column; gap: 3px; min-width: 0; background: none; border: none; padding: 0; text-align: left; font: inherit; color: inherit; }
|
|
8606
8625
|
.ss-w-mol-team { display: flex; align-items: center; gap: 5px; min-width: 0; }
|