@sensiblestats/widget-react 0.7.0 → 0.7.2
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 +12 -0
- package/dist/index.cjs +63 -37
- 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 +63 -37
- package/dist/index.js.map +1 -1
- package/dist/styles.css +27 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Redesign the betting insight card for clarity. The market/selection is now the visual hero, the odds token is unmistakable (legible `ODDS` label + larger value, boxed and tinted). Stats and scope chips are collapsed by default behind a `Show stats` toggle — the reason-to-bet prose carries the justification, and the numbers are one tap away. When expanded, all stat rows show at once (the old three-row `Show N more` cap is removed) and the `This League / All comps / H2H` scopes render as a segmented control. Add to slip stays visible whether stats are open or closed. Adds `showStats` / `hideStats` UI strings (en + tr) to `UiConfig`.
|
|
8
|
+
|
|
9
|
+
## 0.7.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Give the add-to-slip button its own CTA color token (`--ss-w-cta` / `--ss-w-cta-ink`, gold in both themes) instead of reusing the brand accent, so the primary action stands out on the betting insight card.
|
|
14
|
+
|
|
3
15
|
## 0.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -53,6 +53,8 @@ var STRINGS = {
|
|
|
53
53
|
retry: "Retry",
|
|
54
54
|
showLess: "Show less",
|
|
55
55
|
showMore: (n) => `Show ${n} more`,
|
|
56
|
+
showStats: "Show stats",
|
|
57
|
+
hideStats: "Hide stats",
|
|
56
58
|
oddsLabel: "Odds",
|
|
57
59
|
liveLabel: "Live",
|
|
58
60
|
addToSlip: "Add to slip",
|
|
@@ -77,6 +79,8 @@ var STRINGS = {
|
|
|
77
79
|
retry: "Tekrar dene",
|
|
78
80
|
showLess: "Daha az g\xF6ster",
|
|
79
81
|
showMore: (n) => `${n} tane daha g\xF6ster`,
|
|
82
|
+
showStats: "\u0130statistikleri g\xF6ster",
|
|
83
|
+
hideStats: "\u0130statistikleri gizle",
|
|
80
84
|
oddsLabel: "Oran",
|
|
81
85
|
liveLabel: "Canl\u0131",
|
|
82
86
|
addToSlip: "Kupona ekle",
|
|
@@ -118,6 +122,8 @@ function normalizeUi(cfg) {
|
|
|
118
122
|
retry: strings.retry,
|
|
119
123
|
showLess: strings.showLess,
|
|
120
124
|
showMore: strings.showMore,
|
|
125
|
+
showStats: strings.showStats,
|
|
126
|
+
hideStats: strings.hideStats,
|
|
121
127
|
oddsLabel: strings.oddsLabel,
|
|
122
128
|
liveLabel: strings.liveLabel,
|
|
123
129
|
addToSlip: strings.addToSlip,
|
|
@@ -609,26 +615,40 @@ function AddToSlipButton({ it, slip, ui }) {
|
|
|
609
615
|
|
|
610
616
|
// src/components/BettingInsightList.tsx
|
|
611
617
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ss-w-bi-rows", children: [
|
|
618
|
-
shown.map((s) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ss-w-bi-row", children: [
|
|
619
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ss-w-bi-row-lbl", children: s.label }),
|
|
620
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ss-w-bi-row-dots", "aria-hidden": "true" }),
|
|
621
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ss-w-bi-row-num", children: s.value })
|
|
622
|
-
] }, `${s.label}:${s.value}`)),
|
|
623
|
-
overflow > 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "ss-w-bi-more", onClick: () => setExpanded((v) => !v), children: expanded ? ui?.showLess ?? "Show less" : (ui?.showMore ?? ((n) => `Show ${n} more`))(overflow) }) : null
|
|
624
|
-
] });
|
|
618
|
+
function StatRows({ stats }) {
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ss-w-bi-rows", children: stats.map((s) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ss-w-bi-row", children: [
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ss-w-bi-row-lbl", children: s.label }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "ss-w-bi-row-num", children: s.value })
|
|
622
|
+
] }, `${s.label}:${s.value}`)) });
|
|
625
623
|
}
|
|
626
|
-
function ScopedStats({ scopes
|
|
624
|
+
function ScopedStats({ scopes }) {
|
|
627
625
|
const [active, setActive] = (0, import_react5.useState)(0);
|
|
628
626
|
const current = scopes[active] ?? scopes[0] ?? { key: "", label: "", stats: [] };
|
|
629
627
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ss-w-bi-scoped", children: [
|
|
630
628
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ss-w-bi-scopes", role: "group", children: scopes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "ss-w-bi-chip", "aria-pressed": i === active, onClick: () => setActive(i), children: s.label }, s.key)) }),
|
|
631
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StatRows, { stats: current.stats
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StatRows, { stats: current.stats }, current.key)
|
|
630
|
+
] });
|
|
631
|
+
}
|
|
632
|
+
function StatsDisclosure({ it, ui }) {
|
|
633
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
634
|
+
const hasScopes = !!it.scopes && it.scopes.length >= 2;
|
|
635
|
+
const hasStats = hasScopes || it.stats.length > 0;
|
|
636
|
+
if (!hasStats) return null;
|
|
637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "ss-w-bi-stats", children: [
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
639
|
+
"button",
|
|
640
|
+
{
|
|
641
|
+
type: "button",
|
|
642
|
+
className: "ss-w-bi-toggle",
|
|
643
|
+
"aria-expanded": open,
|
|
644
|
+
onClick: () => setOpen((v) => !v),
|
|
645
|
+
children: [
|
|
646
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: open ? ui?.hideStats ?? "Hide stats" : ui?.showStats ?? "Show stats" }),
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `ss-w-bi-chev${open ? " ss-w-bi-chev-up" : ""}`, "aria-hidden": "true" })
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
),
|
|
651
|
+
open ? hasScopes ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScopedStats, { scopes: it.scopes }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StatRows, { stats: it.stats }) : null
|
|
632
652
|
] });
|
|
633
653
|
}
|
|
634
654
|
function InsightCard({ it, ui, slip }) {
|
|
@@ -654,7 +674,7 @@ function InsightCard({ it, ui, slip }) {
|
|
|
654
674
|
] }) : null
|
|
655
675
|
] }),
|
|
656
676
|
it.text ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "ss-w-bi-text", children: it.text }) : null,
|
|
657
|
-
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StatsDisclosure, { it, ui }),
|
|
658
678
|
it.disclaimer ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "ss-w-bi-disc", children: it.disclaimer }) : null,
|
|
659
679
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AddToSlipButton, { it, slip, ui })
|
|
660
680
|
] });
|
|
@@ -810,6 +830,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
810
830
|
.ss-w-root, .ss-w-root * { box-sizing: border-box; margin: 0; padding: 0; }
|
|
811
831
|
.ss-w-root {
|
|
812
832
|
--ss-w-accent: #17936a;
|
|
833
|
+
--ss-w-cta: #f5a623; --ss-w-cta-ink: #1b1300;
|
|
813
834
|
--ss-w-ink: #14181d; --ss-w-faint: #6b7580; --ss-w-line: #e4e8ec;
|
|
814
835
|
--ss-w-panel: #ffffff; --ss-w-bubble: #f3f5f7; --ss-w-nav: #0e1622;
|
|
815
836
|
--ss-w-radius: 16px; --ss-w-offset-x: 20px; --ss-w-offset-y: 20px;
|
|
@@ -818,16 +839,19 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
818
839
|
}
|
|
819
840
|
@media (prefers-color-scheme: dark) {
|
|
820
841
|
.ss-w-root[data-ss-w-theme="auto"] {
|
|
821
|
-
--ss-w-accent: #37c891; --ss-w-
|
|
842
|
+
--ss-w-accent: #37c891; --ss-w-cta: #ffb638; --ss-w-cta-ink: #1b1300;
|
|
843
|
+
--ss-w-ink: #e8edf2; --ss-w-faint: #8b95a1;
|
|
822
844
|
--ss-w-line: #2a3441; --ss-w-panel: #141b24; --ss-w-bubble: #1e2732; --ss-w-nav: #0a0f16;
|
|
823
845
|
}
|
|
824
846
|
}
|
|
825
847
|
.ss-w-root[data-ss-w-theme="dark"] {
|
|
826
|
-
--ss-w-accent: #37c891; --ss-w-
|
|
848
|
+
--ss-w-accent: #37c891; --ss-w-cta: #ffb638; --ss-w-cta-ink: #1b1300;
|
|
849
|
+
--ss-w-ink: #e8edf2; --ss-w-faint: #8b95a1;
|
|
827
850
|
--ss-w-line: #2a3441; --ss-w-panel: #141b24; --ss-w-bubble: #1e2732; --ss-w-nav: #0a0f16;
|
|
828
851
|
}
|
|
829
852
|
.ss-w-root[data-ss-w-theme="light"] {
|
|
830
|
-
--ss-w-accent: #17936a; --ss-w-
|
|
853
|
+
--ss-w-accent: #17936a; --ss-w-cta: #f5a623; --ss-w-cta-ink: #1b1300;
|
|
854
|
+
--ss-w-ink: #14181d; --ss-w-faint: #6b7580;
|
|
831
855
|
--ss-w-line: #e4e8ec; --ss-w-panel: #ffffff; --ss-w-bubble: #f3f5f7; --ss-w-nav: #0e1622;
|
|
832
856
|
}
|
|
833
857
|
|
|
@@ -909,27 +933,29 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
909
933
|
.ss-w-bi-live { font-size: 8.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: #c0392b; border-radius: 4px; padding: 1px 5px; display: inline-flex; align-items: center; gap: 4px; flex: none; }
|
|
910
934
|
.ss-w-bi-live-dot { width: 5px; height: 5px; border-radius: 50%; background: #fff; }
|
|
911
935
|
.ss-w-bi-head { display: flex; align-items: flex-start; gap: 10px; }
|
|
912
|
-
.ss-w-bi-mkt { display: flex; flex-direction: column; gap:
|
|
913
|
-
.ss-w-bi-market { font-size:
|
|
914
|
-
.ss-w-bi-sel { font-size:
|
|
915
|
-
.ss-w-bi-odds { margin-left: auto; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, var(--ss-w-accent) 12%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent)
|
|
916
|
-
.ss-w-bi-odds-cap { font-size:
|
|
917
|
-
.ss-w-bi-odds b { font-size:
|
|
936
|
+
.ss-w-bi-mkt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
937
|
+
.ss-w-bi-market { font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--ss-w-ink); }
|
|
938
|
+
.ss-w-bi-sel { font-size: 12px; line-height: 1.3; color: var(--ss-w-faint); }
|
|
939
|
+
.ss-w-bi-odds { margin-left: auto; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1px; background: color-mix(in srgb, var(--ss-w-accent) 12%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); border-radius: 10px; padding: 4px 11px; min-width: 62px; }
|
|
940
|
+
.ss-w-bi-odds-cap { font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ss-w-faint); }
|
|
941
|
+
.ss-w-bi-odds b { font-size: 19px; font-family: ui-monospace, monospace; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ss-w-accent); line-height: 1.1; }
|
|
918
942
|
.ss-w-bi-book { font-size: 9.5px; color: var(--ss-w-faint); }
|
|
919
|
-
.ss-w-bi-text { font-size: 12px; color: var(--ss-w-ink); }
|
|
943
|
+
.ss-w-bi-text { font-size: 12px; line-height: 1.45; color: var(--ss-w-ink); }
|
|
944
|
+
.ss-w-bi-stats { display: flex; flex-direction: column; gap: 8px; }
|
|
945
|
+
.ss-w-bi-toggle { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; background: none; border: none; color: var(--ss-w-accent); font: inherit; font-size: 11.5px; font-weight: 600; padding: 2px 0; cursor: pointer; }
|
|
946
|
+
.ss-w-bi-toggle:hover { text-decoration: underline; }
|
|
947
|
+
.ss-w-bi-chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
|
|
948
|
+
.ss-w-bi-chev-up { transform: translateY(1px) rotate(-135deg); }
|
|
920
949
|
.ss-w-bi-rows { display: flex; flex-direction: column; }
|
|
921
|
-
.ss-w-bi-row { display: flex; align-items: baseline; gap:
|
|
950
|
+
.ss-w-bi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--ss-w-line); }
|
|
922
951
|
.ss-w-bi-row:first-child { border-top: none; }
|
|
923
|
-
.ss-w-bi-row-lbl { font-size:
|
|
924
|
-
.ss-w-bi-row-
|
|
925
|
-
.ss-w-bi-row-num { font-family: ui-monospace, monospace; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; flex: none; color: var(--ss-w-ink); }
|
|
926
|
-
.ss-w-bi-more { align-self: flex-start; background: none; border: none; color: var(--ss-w-accent); font: inherit; font-size: 11px; font-weight: 560; padding: 2px 0; cursor: pointer; }
|
|
927
|
-
.ss-w-bi-more:hover { text-decoration: underline; }
|
|
952
|
+
.ss-w-bi-row-lbl { font-size: 11.5px; color: var(--ss-w-faint); min-width: 0; }
|
|
953
|
+
.ss-w-bi-row-num { font-family: ui-monospace, monospace; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; flex: none; color: var(--ss-w-ink); }
|
|
928
954
|
.ss-w-bi-disc { font-size: 10px; font-style: italic; color: var(--ss-w-faint); }
|
|
929
|
-
.ss-w-bi-scoped { display: flex; flex-direction: column; gap:
|
|
930
|
-
.ss-w-bi-scopes { display: flex; align-items: center; gap:
|
|
931
|
-
.ss-w-bi-chip { font-size: 11px; font-weight:
|
|
932
|
-
.ss-w-bi-chip[aria-pressed="true"] { color:
|
|
955
|
+
.ss-w-bi-scoped { display: flex; flex-direction: column; gap: 8px; }
|
|
956
|
+
.ss-w-bi-scopes { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; align-self: flex-start; background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); border-radius: 9px; padding: 2px; }
|
|
957
|
+
.ss-w-bi-chip { font-size: 11px; font-weight: 600; border: none; border-radius: 7px; padding: 4px 10px; color: var(--ss-w-faint); background: none; cursor: pointer; }
|
|
958
|
+
.ss-w-bi-chip[aria-pressed="true"] { color: var(--ss-w-ink); background: var(--ss-w-panel); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
|
|
933
959
|
|
|
934
960
|
/* action buttons */
|
|
935
961
|
.ss-w-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
|
|
@@ -956,7 +982,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
956
982
|
|
|
957
983
|
/* add to slip */
|
|
958
984
|
.ss-w-slip { position: relative; display: flex; }
|
|
959
|
-
.ss-w-slip-btn { font-size: 11.5px; font-weight: 620; color:
|
|
985
|
+
.ss-w-slip-btn { font-size: 11.5px; font-weight: 620; color: var(--ss-w-cta-ink); background: var(--ss-w-cta); border: 1px solid var(--ss-w-cta); border-radius: 14px; padding: 5px 12px; cursor: pointer; }
|
|
960
986
|
.ss-w-slip-btn:disabled { opacity: .6; cursor: default; background: var(--ss-w-bubble); color: var(--ss-w-faint); border-color: var(--ss-w-line); }
|
|
961
987
|
.ss-w-toast { position: absolute; top: calc(100% + 6px); left: 0; z-index: 1; max-width: 100%; font-size: 11px; font-weight: 560; border-radius: 10px; padding: 5px 10px; overflow-wrap: anywhere; box-shadow: 0 4px 14px rgba(0,0,0,.14); }
|
|
962
988
|
.ss-w-toast-success { color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 14%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); }
|