@sensiblestats/widget-react 0.72.2 → 0.73.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,11 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.73.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Set the numbers: each row is now one sentence with its numbers, a "3 ready" or "ready at 4.97" line, and a round send button. The picks and combo legs no longer show inside the tool; they appear in the chat after the send. A fourth row offers a second combo that starts high ("Total 50.0 with 6 matches"). The English combo row reads "Combo of 3 paying 5.0".
8
+
3
9
  ## 0.72.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -167,7 +167,10 @@ var STRINGS = {
167
167
  dialName: "Set the numbers and Build a combo",
168
168
  maxPriceRow: "{count} picks, max {price}",
169
169
  minPriceRow: "Picks from {price} up",
170
- comboRow: "A combo of {legs} matches priced at about {total}",
170
+ comboRow: "Combo of {legs} paying {total}",
171
+ bigComboRow: "Total {total} with {legs} matches",
172
+ readyCount: (n) => `${n} ready`,
173
+ readyAt: (total) => `ready at ${total.toFixed(2)}`,
171
174
  maxPriceDisplay: (count, price) => `${count} picks, max ${price.toFixed(2)}`,
172
175
  maxPriceMessage: (count, price) => `Show me ${count} picks priced at ${price.toFixed(2)} or less.`,
173
176
  minPriceDisplay: (count, price) => `${count} picks from ${price.toFixed(2)} up`,
@@ -499,6 +502,9 @@ var STRINGS = {
499
502
  maxPriceRow: "{count} se\xE7im, en fazla {price}",
500
503
  minPriceRow: "{price} ve \xFCzeri se\xE7imler",
501
504
  comboRow: "Yakla\u015F\u0131k {total} oranl\u0131 {legs} ma\xE7l\u0131k kombin",
505
+ bigComboRow: "{legs} ma\xE7la toplam {total}",
506
+ readyCount: (n) => `${n} haz\u0131r`,
507
+ readyAt: (total) => `${total.toFixed(2)} ile haz\u0131r`,
502
508
  maxPriceDisplay: (count, price) => `${count} se\xE7im, en fazla ${price.toFixed(2)}`,
503
509
  maxPriceMessage: (count, price) => `${price.toFixed(2)} veya alt\u0131 oranl\u0131 ${count} se\xE7im g\xF6ster.`,
504
510
  minPriceDisplay: (count, price) => `${count} se\xE7im, ${price.toFixed(2)} ve \xFCzeri`,
@@ -8753,7 +8759,21 @@ function ComboPreview({ cell, formatKickoff }) {
8753
8759
  function Unavailable({ text }) {
8754
8760
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-tool-unavailable", children: text });
8755
8761
  }
8756
- function SetNumbersTool({ grid, strings, streaming, formatKickoff, onSend, onClose }) {
8762
+ function AskRow({ icon, ask, ready, send }) {
8763
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "ss-w-tool-row ss-w-tool-row--ask", children: [
8764
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "ss-w-tool-icon", "aria-hidden": "true", children: icon }),
8765
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "ss-w-tool-main", children: [
8766
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-tool-ask", children: ask }),
8767
+ ready ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "ss-w-tool-ready", children: ready }) : null
8768
+ ] }),
8769
+ send
8770
+ ] });
8771
+ }
8772
+ function RoundSend({ label, display, disabled, onClick }) {
8773
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SendIcon, {}) });
8774
+ }
8775
+ var BIG_COMBO = { total: 50, legs: 6 };
8776
+ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8757
8777
  const limits = singlesLimits(grid);
8758
8778
  const floors = singlesFloors(grid);
8759
8779
  const totals = comboTotals(grid);
@@ -8764,10 +8784,14 @@ function SetNumbersTool({ grid, strings, streaming, formatKickoff, onSend, onClo
8764
8784
  const [start] = (0, import_react51.useState)(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
8765
8785
  const [total, setTotal] = (0, import_react51.useState)(start.total);
8766
8786
  const [legs, setLegs] = (0, import_react51.useState)(start.legs);
8787
+ const [bigStart] = (0, import_react51.useState)(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
8788
+ const [bigTotal, setBigTotal] = (0, import_react51.useState)(bigStart.total);
8789
+ const [bigLegs, setBigLegs] = (0, import_react51.useState)(bigStart.legs);
8767
8790
  const [announcement, setAnnouncement] = (0, import_react51.useState)("");
8768
8791
  const maxCell = findSingles(grid.singles, maxPrice, count);
8769
8792
  const minCell = findSingles(grid.singlesFrom, minPrice, count);
8770
8793
  const comboCell = findCombo(grid, total, legs);
8794
+ const bigCell = findCombo(grid, bigTotal, bigLegs);
8771
8795
  const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
8772
8796
  const chooseMax = (v) => {
8773
8797
  setMaxPrice(v);
@@ -8787,41 +8811,79 @@ function SetNumbersTool({ grid, strings, streaming, formatKickoff, onSend, onClo
8787
8811
  setLegs(l);
8788
8812
  announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
8789
8813
  };
8814
+ const chooseBigLegs = (v) => {
8815
+ setBigLegs(v);
8816
+ announce(strings.comboDisplay(v, bigTotal), !!findCombo(grid, bigTotal, v));
8817
+ };
8818
+ const chooseBigTotal = (v) => {
8819
+ const l = legsForTotal(grid, v, bigLegs);
8820
+ setBigTotal(v);
8821
+ setBigLegs(l);
8822
+ announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
8823
+ };
8790
8824
  const maxChoices = limits.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singles, v, count) }));
8791
8825
  const minChoices = floors.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singlesFrom, v, count) }));
8792
8826
  const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
8793
- const legChoicesList = legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, total, n) }));
8827
+ const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
8828
+ const singlesReady = (cell) => cell ? strings.readyCount(cell.picks.length) : strings.unavailable;
8829
+ const comboReady = (cell) => cell ? strings.readyAt(cell.combo.total) : strings.unavailable;
8794
8830
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
8795
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "ss-w-tool-row", children: [
8796
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-tool-ask", children: fillTemplate(strings.maxPriceRow, {
8797
- count: String(count),
8798
- price: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: maxPrice.toFixed(2), choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
8799
- }) }),
8800
- maxCell ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(PickList, { picks: maxCell.picks, formatKickoff }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Unavailable, { text: strings.unavailable }),
8801
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SendButton, { label: strings.send, display: strings.maxPriceDisplay(count, maxPrice), disabled: !maxCell || streaming, onClick: () => {
8802
- if (maxCell) onSend(maxPriceAsk(maxCell, strings));
8803
- } })
8804
- ] }),
8805
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "ss-w-tool-row", children: [
8806
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-tool-ask", children: fillTemplate(strings.minPriceRow, {
8807
- count: String(count),
8808
- price: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: minPrice.toFixed(2), choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
8809
- }) }),
8810
- minCell ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(PickList, { picks: minCell.picks, formatKickoff }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Unavailable, { text: strings.unavailable }),
8811
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SendButton, { label: strings.send, display: strings.minPriceDisplay(count, minPrice), disabled: !minCell || streaming, onClick: () => {
8812
- if (minCell) onSend(minPriceAsk(minCell, strings));
8813
- } })
8814
- ] }),
8815
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "ss-w-tool-row", children: [
8816
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-tool-ask", children: fillTemplate(strings.comboRow, {
8817
- legs: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: String(legs), choices: legChoicesList, label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseLegs }),
8818
- total: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: total.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseTotal })
8819
- }) }),
8820
- comboCell ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ComboPreview, { cell: comboCell, formatKickoff }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Unavailable, { text: strings.unavailable }),
8821
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SendButton, { label: strings.send, display: strings.comboDisplay(legs, total), disabled: !comboCell || streaming, onClick: () => {
8822
- if (comboCell) onSend(comboAsk(comboCell, strings));
8823
- } })
8824
- ] }),
8831
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8832
+ AskRow,
8833
+ {
8834
+ icon: "\u{1F3AF}",
8835
+ ask: fillTemplate(strings.maxPriceRow, {
8836
+ count: String(count),
8837
+ price: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: maxPrice.toFixed(2), choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
8838
+ }),
8839
+ ready: singlesReady(maxCell),
8840
+ send: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RoundSend, { label: strings.send, display: strings.maxPriceDisplay(count, maxPrice), disabled: !maxCell || streaming, onClick: () => {
8841
+ if (maxCell) onSend(maxPriceAsk(maxCell, strings));
8842
+ } })
8843
+ }
8844
+ ),
8845
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8846
+ AskRow,
8847
+ {
8848
+ icon: "\u{1F4C8}",
8849
+ ask: fillTemplate(strings.minPriceRow, {
8850
+ count: String(count),
8851
+ price: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: minPrice.toFixed(2), choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
8852
+ }),
8853
+ ready: singlesReady(minCell),
8854
+ send: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RoundSend, { label: strings.send, display: strings.minPriceDisplay(count, minPrice), disabled: !minCell || streaming, onClick: () => {
8855
+ if (minCell) onSend(minPriceAsk(minCell, strings));
8856
+ } })
8857
+ }
8858
+ ),
8859
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8860
+ AskRow,
8861
+ {
8862
+ icon: "\u2728",
8863
+ ask: fillTemplate(strings.comboRow, {
8864
+ legs: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: String(legs), choices: legChoicesFor(total), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseLegs }),
8865
+ total: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: total.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseTotal })
8866
+ }),
8867
+ ready: comboReady(comboCell),
8868
+ send: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RoundSend, { label: strings.send, display: strings.comboDisplay(legs, total), disabled: !comboCell || streaming, onClick: () => {
8869
+ if (comboCell) onSend(comboAsk(comboCell, strings));
8870
+ } })
8871
+ }
8872
+ ),
8873
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8874
+ AskRow,
8875
+ {
8876
+ icon: "\u{1F3C6}",
8877
+ ask: fillTemplate(strings.bigComboRow, {
8878
+ legs: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: String(bigLegs), choices: legChoicesFor(bigTotal), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseBigLegs }),
8879
+ total: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberSelect, { current: bigTotal.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseBigTotal })
8880
+ }),
8881
+ ready: comboReady(bigCell),
8882
+ send: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RoundSend, { label: strings.send, display: strings.comboDisplay(bigLegs, bigTotal), disabled: !bigCell || streaming, onClick: () => {
8883
+ if (bigCell) onSend(comboAsk(bigCell, strings));
8884
+ } })
8885
+ }
8886
+ ),
8825
8887
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
8826
8888
  ] });
8827
8889
  }
@@ -9096,7 +9158,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
9096
9158
  buttonRef: dialButtonRef
9097
9159
  }
9098
9160
  ) : null,
9099
- tool && presetGrid && onChatTab ? tool.kind === "numbers" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, onSend: sendAsk, onClose: closeTool }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
9161
+ tool && presetGrid && onChatTab ? tool.kind === "numbers" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, onSend: sendAsk, onClose: closeTool }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
9100
9162
  ] }),
9101
9163
  monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TodayPanel, { discovery, ui, monitor }),
9102
9164
  monitor && monitor.activeTab === "following" && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MatchesPanel, { monitor, ui, slip, onAsk: handleAsk }),
@@ -9602,6 +9664,13 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
9602
9664
  .ss-w-tool-pick-price { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 800; color: var(--ss-w-accent); }
9603
9665
  .ss-w-tool-math { padding: 6px 8px; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; text-align: right; color: var(--ss-w-ink); background: color-mix(in srgb, var(--ss-w-accent) 9%, var(--ss-w-panel)); border-radius: 8px; overflow-wrap: anywhere; }
9604
9666
  .ss-w-tool-unavailable { padding: 6px 8px; font-size: 12px; color: var(--ss-w-faint); border: 1px dashed var(--ss-w-line); border-radius: 8px; }
9667
+ .ss-w-tool-row--ask { flex-direction: row; align-items: center; gap: 10px; border-left-width: 1px; }
9668
+ .ss-w-tool-icon { flex: none; font-size: 20px; line-height: 1; }
9669
+ .ss-w-tool-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
9670
+ .ss-w-tool-ready { padding: 2px 8px; font-size: 11.5px; font-weight: 650; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 12%, transparent); border-radius: 10px; }
9671
+ .ss-w-tool-go { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 17px; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 50%; cursor: pointer; }
9672
+ .ss-w-tool-go:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
9673
+ .ss-w-tool-go:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
9605
9674
  .ss-w-tool-send { align-self: flex-end; min-height: 40px; padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 20px; cursor: pointer; }
9606
9675
  .ss-w-tool-send:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
9607
9676
  .ss-w-tool-foot .ss-w-tool-send { width: 100%; }