@pie-element/match 12.1.2-next.7 → 12.1.2-next.9

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.
@@ -1,5 +1,5 @@
1
1
  import { a as e } from "../browser-kkT1XVKw.js";
2
- import { Nt as t, O as n, a as r, d as i, dt as a, f as o, ft as s, ht as c, k as l, n as u, p as d, pt as f, r as p, t as m, u as h, x as g } from "../Typography-BvyMwfyW.js";
2
+ import { Nt as t, O as n, a as r, d as i, dt as a, f as o, ft as s, ht as c, k as l, n as u, p as d, pt as f, r as p, t as m, u as h, x as g } from "../Typography-DS6VD63M.js";
3
3
  import _, { useRef as v } from "react";
4
4
  import { createRoot as y } from "react-dom/client";
5
5
  import { jsx as b, jsxs as x } from "react/jsx-runtime";
@@ -1755,14 +1755,18 @@ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.defaul
1755
1755
  let { correctAnswers: r } = this.props;
1756
1756
  return r[e][n] === !0 && t === !1 || r[e][n] === !1 && t === !0;
1757
1757
  };
1758
+ controlColor = (e, t, n) => {
1759
+ let { showCorrect: r, disabled: i, view: a } = this.props, o = i && !a;
1760
+ return r && t === !0 || o && this.answerIsCorrect(e, t, n) ? s.correct() : o && this.answerIsIncorrect(e, t, n) ? s.incorrect() : t === !0 && !o ? s.primary() : i ? s.disabled() : s.text();
1761
+ };
1758
1762
  render() {
1759
- let { showCorrect: e, headers: t, rows: n, choiceMode: r, answers: i, disabled: a, view: o } = this.props, c = r === "radio" ? p : u, l = a && !o;
1760
- return !n || n.length === 0 ? /* @__PURE__ */ b(et, { children: /* @__PURE__ */ b(nt, {
1763
+ let { headers: e, rows: t, choiceMode: n, answers: r, disabled: i } = this.props, a = n === "radio" ? p : u;
1764
+ return !t || t.length === 0 ? /* @__PURE__ */ b(et, { children: /* @__PURE__ */ b(nt, {
1761
1765
  component: "div",
1762
1766
  children: "There are currently no questions to show."
1763
1767
  }) }) : /* @__PURE__ */ b(et, { children: /* @__PURE__ */ x(at, { children: [
1764
- /* @__PURE__ */ b("colgroup", { children: (t || []).map((e, t) => /* @__PURE__ */ b("col", {}, `col-${t}`)) }),
1765
- /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: (t || []).map((e, t) => /* @__PURE__ */ b(rt, {
1768
+ /* @__PURE__ */ b("colgroup", { children: (e || []).map((e, t) => /* @__PURE__ */ b("col", {}, `col-${t}`)) }),
1769
+ /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: (e || []).map((e, t) => /* @__PURE__ */ b(rt, {
1766
1770
  "data-colno": `${t}`,
1767
1771
  scope: "row",
1768
1772
  children: /* @__PURE__ */ b(J, {
@@ -1770,33 +1774,37 @@ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.defaul
1770
1774
  dangerouslySetInnerHTML: { __html: e }
1771
1775
  })
1772
1776
  }, `th-${t}`)) }) }),
1773
- (n || []).map((t, n) => /* @__PURE__ */ b("tbody", {
1777
+ (t || []).map((e, t) => /* @__PURE__ */ b("tbody", {
1774
1778
  role: "group",
1775
1779
  children: /* @__PURE__ */ x(it, { children: [/* @__PURE__ */ b("td", {
1776
1780
  "data-colno": "0",
1777
1781
  children: /* @__PURE__ */ b(J, {
1778
1782
  isQuestionText: !0,
1779
- dangerouslySetInnerHTML: { __html: t.title }
1783
+ dangerouslySetInnerHTML: { __html: e.title }
1780
1784
  })
1781
- }, `td-title-${n}`), (i[t.id] || []).map((r, i) => /* @__PURE__ */ b(tt, {
1782
- "data-colno": `${i + 1}`,
1783
- children: /* @__PURE__ */ b(J, { children: /* @__PURE__ */ b(c, {
1784
- sx: {
1785
- padding: "6px",
1786
- color: e && r === !0 || l && this.answerIsCorrect(t.id, r, i) ? s.correct() : l && this.answerIsIncorrect(t.id, r, i) ? s.incorrect() : r === !0 && !l ? s.primary() : a ? s.disabled() : s.text(),
1787
- cursor: a ? "not-allowed" : "pointer",
1788
- pointerEvents: a ? "initial" : "auto",
1789
- opacity: a ? .7 : 1,
1790
- "& input": { width: "100% !important" },
1791
- "&:hover": { color: a ? s.disabled() : s.primaryLight() },
1792
- "&.Mui-disabled": { color: `${e && r === !0 || l && this.answerIsCorrect(t.id, r, i) ? s.correct() : l && this.answerIsIncorrect(t.id, r, i) ? s.incorrect() : r === !0 && !l ? s.primary() : s.disabled()}` }
1793
- },
1794
- disabled: a,
1795
- onChange: this.onRowValueChange(t.id, i),
1796
- checked: r === !0
1797
- }) })
1798
- }, `td-${n}-${i}`))] })
1799
- }, `row-${n}`))
1785
+ }, `td-title-${t}`), (r[e.id] || []).map((n, r) => {
1786
+ let o = this.controlColor(e.id, n, r);
1787
+ return /* @__PURE__ */ b(tt, {
1788
+ "data-colno": `${r + 1}`,
1789
+ children: /* @__PURE__ */ b(J, { children: /* @__PURE__ */ b(a, {
1790
+ sx: {
1791
+ padding: "6px",
1792
+ color: o,
1793
+ "&&.Mui-checked": { color: o },
1794
+ "&&.Mui-disabled": { color: o },
1795
+ cursor: i ? "not-allowed" : "pointer",
1796
+ pointerEvents: i ? "initial" : "auto",
1797
+ opacity: i ? .7 : 1,
1798
+ "& input": { width: "100% !important" },
1799
+ "&&:hover:not(.Mui-disabled)": { color: s.primaryLight() }
1800
+ },
1801
+ disabled: i,
1802
+ onChange: this.onRowValueChange(e.id, r),
1803
+ checked: n === !0
1804
+ }) })
1805
+ }, `td-${t}-${r}`);
1806
+ })] })
1807
+ }, `row-${t}`))
1800
1808
  ] }) });
1801
1809
  }
1802
1810
  };