@pie-element/rubric 9.0.2-next.20261007003844 → 9.0.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.
@@ -1,150 +0,0 @@
1
- import { m as e } from "./speech-worker-CP5P4gRS-OkQyXQak.js";
2
- import { Ct as t, G as n, M as r, W as i, _ as a, f as o, it as s, j as c, t as l, x as u } from "./dist-DoJ97vep.js";
3
- import d from "react";
4
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
5
- //#region src/delivery/main.tsx
6
- var m = /* @__PURE__ */ e(t(), 1);
7
- function h(e) {
8
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
9
- }
10
- function g(e, t) {
11
- return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
12
- }
13
- var _ = g(o, "UiLayout") || g(b.UiLayout, "UiLayout"), v = l, y = v.default, b = y && typeof y == "object" ? y : v, { translator: x } = a, S = s(_)({
14
- color: c.text(),
15
- backgroundColor: c.background(),
16
- "&:not(.MathJax) table": { borderCollapse: "collapse" },
17
- "&:not(.MathJax) table td, &:not(.MathJax) table th": {
18
- padding: "8px 12px",
19
- textAlign: "left"
20
- },
21
- "& ul p, & ol p": {
22
- marginBottom: 0,
23
- marginTop: 0,
24
- lineHeight: "normal"
25
- }
26
- }), C = s(n)({
27
- display: "flex",
28
- flexDirection: "column",
29
- alignItems: "flex-start",
30
- padding: "12px 0px"
31
- }), w = s("div")({ color: c.text() }), T = s("h3")({
32
- color: c.text(),
33
- fontSize: "16px",
34
- fontWeight: "700",
35
- margin: 0,
36
- paddingBottom: "6px"
37
- }), E = s("h4")({
38
- color: c.text(),
39
- fontSize: "16px",
40
- fontWeight: "normal",
41
- margin: 0,
42
- paddingBottom: "6px"
43
- }), D = s("button")(({ theme: e }) => ({
44
- display: "flex",
45
- alignItems: "center",
46
- width: "100%",
47
- padding: 0,
48
- border: 0,
49
- background: "transparent",
50
- font: "inherit",
51
- textAlign: "inherit",
52
- cursor: "pointer",
53
- userSelect: "none",
54
- fontSize: e.typography.fontSize,
55
- fontWeight: "500",
56
- color: c.tertiary(),
57
- margin: 0,
58
- minHeight: 24
59
- })), O = s("span")({
60
- display: "inline-flex",
61
- transition: "transform 0.2s",
62
- marginLeft: 2,
63
- alignSelf: "center"
64
- }), k = s("h2")({
65
- position: "absolute",
66
- width: "1px",
67
- height: "1px",
68
- padding: 0,
69
- margin: "-1px",
70
- overflow: "hidden",
71
- clip: "rect(0,0,0,0)",
72
- border: 0,
73
- whiteSpace: "nowrap"
74
- }), A = m.default.shape({
75
- excludeZero: m.default.bool,
76
- points: m.default.arrayOf(m.default.string),
77
- sampleAnswers: m.default.arrayOf(m.default.string),
78
- animationsDisabled: m.default.bool
79
- }), j = class extends d.Component {
80
- dudUrl = "javascript:;";
81
- idPrefix = u("rubric");
82
- constructor(e) {
83
- super(e), this.state = { rubricOpen: !1 }, this.toggleRubric = this.toggleRubric.bind(this);
84
- }
85
- static propTypes = {
86
- model: m.default.object.isRequired,
87
- animationsDisabled: m.default.bool,
88
- value: A
89
- };
90
- toggleRubric() {
91
- this.setState({ rubricOpen: !this.state.rubricOpen });
92
- }
93
- shouldRenderPoint = (e, t) => !t.excludeZero || e !== 0;
94
- render() {
95
- let { model: e, value: t } = this.props, { animationsDisabled: n } = this.props;
96
- if (n ||= t.animationsDisabled, t && t.points) {
97
- let { extraCSSRules: a } = e || {}, { points: o, sampleAnswers: s } = t, c = /* @__PURE__ */ f(i, { children: o.slice(0).reverse().map((e, n) => {
98
- n = o.length - n - 1;
99
- let r = t.excludeZero ? n + 1 : n;
100
- return /* @__PURE__ */ p(d.Fragment, { children: [/* @__PURE__ */ p(C, { children: [/* @__PURE__ */ f(T, { children: r === 1 ? `${r} PT` : `${r} PTS` }), /* @__PURE__ */ f(w, { dangerouslySetInnerHTML: { __html: e } })] }, `P${n}`), s && s[n] && /* @__PURE__ */ p(C, { children: [/* @__PURE__ */ f(E, { children: "Sample Answer" }), /* @__PURE__ */ f(w, { dangerouslySetInnerHTML: { __html: s[n] } })] }, `S${n}`)] }, n);
101
- }) });
102
- return /* @__PURE__ */ p(S, {
103
- extraCSSRules: a,
104
- children: [/* @__PURE__ */ f(k, { children: x.t("rubric.rubric", { lng: t.language }) }), n ? c : /* @__PURE__ */ p(d.Fragment, { children: [/* @__PURE__ */ p(D, {
105
- type: "button",
106
- id: `${this.idPrefix}-toggle`,
107
- "aria-expanded": this.state.rubricOpen,
108
- "aria-controls": `${this.idPrefix}-content`,
109
- onClick: this.toggleRubric,
110
- children: [x.t(this.state.rubricOpen ? "rubric.hideRubric" : "rubric.showRubric", { lng: t.language }), /* @__PURE__ */ f(O, {
111
- "aria-hidden": "true",
112
- children: this.state.rubricOpen ? /* @__PURE__ */ f("svg", {
113
- width: "20",
114
- height: "20",
115
- viewBox: "0 0 24 24",
116
- fill: "none",
117
- stroke: "currentColor",
118
- strokeWidth: "2",
119
- strokeLinecap: "round",
120
- strokeLinejoin: "round",
121
- children: /* @__PURE__ */ f("polyline", { points: "18 15 12 9 6 15" })
122
- }) : /* @__PURE__ */ f("svg", {
123
- width: "20",
124
- height: "20",
125
- viewBox: "0 0 24 24",
126
- fill: "none",
127
- stroke: "currentColor",
128
- strokeWidth: "2",
129
- strokeLinecap: "round",
130
- strokeLinejoin: "round",
131
- children: /* @__PURE__ */ f("polyline", { points: "6 9 12 15 18 9" })
132
- })
133
- })]
134
- }), /* @__PURE__ */ f(r, {
135
- id: `${this.idPrefix}-content`,
136
- in: this.state.rubricOpen,
137
- timeout: {
138
- enter: 225,
139
- exit: 195
140
- },
141
- children: c
142
- })] })]
143
- });
144
- } else return null;
145
- }
146
- };
147
- //#endregion
148
- export { j as t };
149
-
150
- //# sourceMappingURL=main-BvWtvcxv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main-BvWtvcxv.js","names":[],"sources":["../../../src/delivery/main.tsx"],"sourcesContent":["// @ts-nocheck\n\nimport React from 'react';\nimport { styled } from '@mui/material/styles';\nimport ListItem from '@mui/material/ListItem';\nimport List from '@mui/material/List';\nimport Collapse from '@mui/material/Collapse';\nimport { color, createUniqueId, UiLayout as UiLayoutImport } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport PropTypes from 'prop-types';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst StyledUiLayout: any = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n // apply styles to tables to match the rest of the UI\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '8px 12px',\n textAlign: 'left',\n },\n // reset paragraph margins and line-height inside lists to override client styles\n '& ul p, & ol p': {\n marginBottom: 0,\n marginTop: 0,\n lineHeight: 'normal',\n },\n});\n\nconst StyledListItem: any = styled(ListItem)({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n padding: '12px 0px',\n});\n\nconst Text: any = styled('div')({\n color: color.text(),\n});\n\nconst TitleText: any = styled('h3')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: '700',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst SampleTitleText: any = styled('h4')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: 'normal',\n margin: 0,\n paddingBottom: '6px',\n});\n\n// A native button handles Enter and Space without scrolling the page; the resets drop the\n// browser's button chrome and keep it full width.\nconst RubricToggle: any = styled('button')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n padding: 0,\n border: 0,\n background: 'transparent',\n font: 'inherit',\n textAlign: 'inherit',\n cursor: 'pointer',\n userSelect: 'none',\n fontSize: theme.typography.fontSize,\n fontWeight: '500',\n color: color.tertiary(),\n margin: 0,\n minHeight: 24,\n}));\n\nconst ChevronStyle: any = styled('span')({\n display: 'inline-flex',\n transition: 'transform 0.2s',\n marginLeft: 2,\n alignSelf: 'center',\n});\n\nconst HiddenScreenReader: any = styled('h2')({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0,0,0,0)',\n border: 0,\n whiteSpace: 'nowrap',\n});\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n animationsDisabled: PropTypes.bool,\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n idPrefix = createUniqueId('rubric');\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n model: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n }\n\n shouldRenderPoint: any = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { model, value } = this.props;\n let { animationsDisabled } = this.props;\n animationsDisabled = animationsDisabled || value.animationsDisabled;\n\n if (value && value.points) {\n const { extraCSSRules } = model || {};\n const { points, sampleAnswers } = value;\n\n const rubricList = (\n <List>\n {points\n .slice(0)\n .reverse()\n .map((desc, index) => {\n index = points.length - index - 1;\n const pointsLabel = value.excludeZero ? index + 1 : index;\n\n return (\n <React.Fragment key={index}>\n <StyledListItem key={`P${index}`}>\n <TitleText>\n {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}\n </TitleText>\n <Text dangerouslySetInnerHTML={{ __html: desc }} />\n </StyledListItem>\n\n {sampleAnswers && sampleAnswers[index] && (\n <StyledListItem key={`S${index}`}>\n <SampleTitleText>\n Sample Answer\n </SampleTitleText>\n <Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n </StyledListItem>\n )}\n </React.Fragment>\n );\n })}\n </List>\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules}>\n {/* screen reader only heading for navigation as per PD-5057 */}\n <HiddenScreenReader>{translator.t('rubric.rubric', { lng: value.language })}</HiddenScreenReader>\n {!animationsDisabled ? (\n <React.Fragment>\n <RubricToggle\n type=\"button\"\n id={`${this.idPrefix}-toggle`}\n aria-expanded={this.state.rubricOpen}\n aria-controls={`${this.idPrefix}-content`}\n onClick={this.toggleRubric}\n >\n {translator.t(this.state.rubricOpen ? 'rubric.hideRubric' : 'rubric.showRubric', {\n lng: value.language,\n })}\n <ChevronStyle aria-hidden=\"true\">\n {this.state.rubricOpen ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n )}\n </ChevronStyle>\n </RubricToggle>\n <Collapse\n id={`${this.idPrefix}-content`}\n in={this.state.rubricOpen}\n timeout={{ enter: 225, exit: 195 }}\n >\n {rubricList}\n </Collapse>\n </React.Fragment>\n ) : (\n rubricList\n )}\n </StyledUiLayout>\n );\n } else {\n return null;\n }\n }\n}\n\nexport default Rubric;\n"],"mappings":";;;;;;AASA,SAAS,EAA6B,GAAY;CAChD,OACE,OAAO,KAAU,cAChB,OAAO,KAAU,cAAY,KAAkB,OAAO,EAAM,YAAa;AAE9E;AAEA,SAAS,EAAyB,GAAkB,GAAsB;CAUxE,OATI,CAAC,KACD,EAA6B,CAAW,IAAU,IAClD,EAA6B,EAAY,OAAO,IAAU,EAAY,UACtE,KAAe,EAA6B,EAAY,EAAY,IAC/D,EAAY,KAEjB,KAAe,EAA6B,EAAY,EAAY,EAAE,OAAO,IACxE,EAAY,EAAY,CAAC,UAE3B;AACT;AACA,IAAM,IAAW,EAAyB,GAAgB,UAAU,KAAK,EAAyB,EAAS,UAAU,UAAU,GAEzH,IAAuB,GACvB,IAAuB,EAAqB,SAC5C,IACJ,KAAwB,OAAO,KAAyB,WACpD,IACA,GAIA,EAAE,kBAAe,GAEjB,IAAsB,EAAO,CAAQ,CAAC,CAAC;CAC3C,OAAO,EAAM,KAAK;CAClB,iBAAiB,EAAM,WAAW;CAElC,yBAAyB,EACvB,gBAAgB,WAClB;CACA,sDAAsD;EACpD,SAAS;EACT,WAAW;CACb;CAEA,kBAAkB;EAChB,cAAc;EACd,WAAW;EACX,YAAY;CACd;AACF,CAAC,GAEK,IAAsB,EAAO,CAAQ,CAAC,CAAC;CAC3C,SAAS;CACT,eAAe;CACf,YAAY;CACZ,SAAS;AACX,CAAC,GAEK,I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UAAP,EAAA,UAAA,CACE,kBAAC,GAAD;KACE,MAAK;KACL,IAAI,GAAG,KAAK,SAAS;KACrB,iBAAe,KAAK,MAAM;KAC1B,iBAAe,GAAG,KAAK,SAAS;KAChC,SAAS,KAAK;eALhB,CAOG,EAAW,EAAE,KAAK,MAAM,aAAa,sBAAsB,qBAAqB,EAC/E,KAAK,EAAM,SACb,CAAC,GACD,kBAAC,GAAD;MAAc,eAAY;gBACvB,KAAK,MAAM,aACV,kBAAC,OAAD;OACE,OAAM;OACN,QAAO;OACP,SAAQ;OACR,MAAK;OACL,QAAO;OACP,aAAY;OACZ,eAAc;OACd,gBAAe;iBAEf,kBAAC,YAAD,EAAU,QAAO,kBAA4B,CAAA;MAC1C,CAAA,IAEL,kBAAC,OAAD;OACE,OAAM;OACN,QAAO;OACP,SAAQ;OACR,MAAK;OACL,QAAO;OACP,aAAY;OACZ,eAAc;OACd,gBAAe;iBAEf,kBAAC,YAAD,EAAU,QAAO,iBAA2B,CAAA;MACzC,CAAA;KAEK,CAAA,CACF;QACd,kBAAC,GAAD;KACE,IAAI,GAAG,KAAK,SAAS;KACrB,IAAI,KAAK,MAAM;KACf,SAAS;MAAE,OAAO;MAAK,MAAM;KAAI;eAEhC;IACO,CAAA,CACI,EAAA,CAAA,CAIJ;;EAEpB,OACE,OAAO;CAEX;AACF"}
@@ -1,150 +0,0 @@
1
- import { p as e } from "./speech-worker-CP5P4gRS-G4rtBs8u.js";
2
- import { Ct as t, G as n, M as r, W as i, _ as a, f as o, it as s, j as c, t as l, x as u } from "./dist-Das8lbco.js";
3
- import d from "react";
4
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
5
- //#region src/delivery/main.tsx
6
- var m = /* @__PURE__ */ e(t(), 1);
7
- function h(e) {
8
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
9
- }
10
- function g(e, t) {
11
- return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
12
- }
13
- var _ = g(o, "UiLayout") || g(b.UiLayout, "UiLayout"), v = l, y = v.default, b = y && typeof y == "object" ? y : v, { translator: x } = a, S = s(_)({
14
- color: c.text(),
15
- backgroundColor: c.background(),
16
- "&:not(.MathJax) table": { borderCollapse: "collapse" },
17
- "&:not(.MathJax) table td, &:not(.MathJax) table th": {
18
- padding: "8px 12px",
19
- textAlign: "left"
20
- },
21
- "& ul p, & ol p": {
22
- marginBottom: 0,
23
- marginTop: 0,
24
- lineHeight: "normal"
25
- }
26
- }), C = s(n)({
27
- display: "flex",
28
- flexDirection: "column",
29
- alignItems: "flex-start",
30
- padding: "12px 0px"
31
- }), w = s("div")({ color: c.text() }), T = s("h3")({
32
- color: c.text(),
33
- fontSize: "16px",
34
- fontWeight: "700",
35
- margin: 0,
36
- paddingBottom: "6px"
37
- }), E = s("h4")({
38
- color: c.text(),
39
- fontSize: "16px",
40
- fontWeight: "normal",
41
- margin: 0,
42
- paddingBottom: "6px"
43
- }), D = s("button")(({ theme: e }) => ({
44
- display: "flex",
45
- alignItems: "center",
46
- width: "100%",
47
- padding: 0,
48
- border: 0,
49
- background: "transparent",
50
- font: "inherit",
51
- textAlign: "inherit",
52
- cursor: "pointer",
53
- userSelect: "none",
54
- fontSize: e.typography.fontSize,
55
- fontWeight: "500",
56
- color: c.tertiary(),
57
- margin: 0,
58
- minHeight: 24
59
- })), O = s("span")({
60
- display: "inline-flex",
61
- transition: "transform 0.2s",
62
- marginLeft: 2,
63
- alignSelf: "center"
64
- }), k = s("h2")({
65
- position: "absolute",
66
- width: "1px",
67
- height: "1px",
68
- padding: 0,
69
- margin: "-1px",
70
- overflow: "hidden",
71
- clip: "rect(0,0,0,0)",
72
- border: 0,
73
- whiteSpace: "nowrap"
74
- }), A = m.default.shape({
75
- excludeZero: m.default.bool,
76
- points: m.default.arrayOf(m.default.string),
77
- sampleAnswers: m.default.arrayOf(m.default.string),
78
- animationsDisabled: m.default.bool
79
- }), j = class extends d.Component {
80
- dudUrl = "javascript:;";
81
- idPrefix = u("rubric");
82
- constructor(e) {
83
- super(e), this.state = { rubricOpen: !1 }, this.toggleRubric = this.toggleRubric.bind(this);
84
- }
85
- static propTypes = {
86
- model: m.default.object.isRequired,
87
- animationsDisabled: m.default.bool,
88
- value: A
89
- };
90
- toggleRubric() {
91
- this.setState({ rubricOpen: !this.state.rubricOpen });
92
- }
93
- shouldRenderPoint = (e, t) => !t.excludeZero || e !== 0;
94
- render() {
95
- let { model: e, value: t } = this.props, { animationsDisabled: n } = this.props;
96
- if (n ||= t.animationsDisabled, t && t.points) {
97
- let { extraCSSRules: a } = e || {}, { points: o, sampleAnswers: s } = t, c = /* @__PURE__ */ f(i, { children: o.slice(0).reverse().map((e, n) => {
98
- n = o.length - n - 1;
99
- let r = t.excludeZero ? n + 1 : n;
100
- return /* @__PURE__ */ p(d.Fragment, { children: [/* @__PURE__ */ p(C, { children: [/* @__PURE__ */ f(T, { children: r === 1 ? `${r} PT` : `${r} PTS` }), /* @__PURE__ */ f(w, { dangerouslySetInnerHTML: { __html: e } })] }, `P${n}`), s && s[n] && /* @__PURE__ */ p(C, { children: [/* @__PURE__ */ f(E, { children: "Sample Answer" }), /* @__PURE__ */ f(w, { dangerouslySetInnerHTML: { __html: s[n] } })] }, `S${n}`)] }, n);
101
- }) });
102
- return /* @__PURE__ */ p(S, {
103
- extraCSSRules: a,
104
- children: [/* @__PURE__ */ f(k, { children: x.t("rubric.rubric", { lng: t.language }) }), n ? c : /* @__PURE__ */ p(d.Fragment, { children: [/* @__PURE__ */ p(D, {
105
- type: "button",
106
- id: `${this.idPrefix}-toggle`,
107
- "aria-expanded": this.state.rubricOpen,
108
- "aria-controls": `${this.idPrefix}-content`,
109
- onClick: this.toggleRubric,
110
- children: [x.t(this.state.rubricOpen ? "rubric.hideRubric" : "rubric.showRubric", { lng: t.language }), /* @__PURE__ */ f(O, {
111
- "aria-hidden": "true",
112
- children: this.state.rubricOpen ? /* @__PURE__ */ f("svg", {
113
- width: "20",
114
- height: "20",
115
- viewBox: "0 0 24 24",
116
- fill: "none",
117
- stroke: "currentColor",
118
- strokeWidth: "2",
119
- strokeLinecap: "round",
120
- strokeLinejoin: "round",
121
- children: /* @__PURE__ */ f("polyline", { points: "18 15 12 9 6 15" })
122
- }) : /* @__PURE__ */ f("svg", {
123
- width: "20",
124
- height: "20",
125
- viewBox: "0 0 24 24",
126
- fill: "none",
127
- stroke: "currentColor",
128
- strokeWidth: "2",
129
- strokeLinecap: "round",
130
- strokeLinejoin: "round",
131
- children: /* @__PURE__ */ f("polyline", { points: "6 9 12 15 18 9" })
132
- })
133
- })]
134
- }), /* @__PURE__ */ f(r, {
135
- id: `${this.idPrefix}-content`,
136
- in: this.state.rubricOpen,
137
- timeout: {
138
- enter: 225,
139
- exit: 195
140
- },
141
- children: c
142
- })] })]
143
- });
144
- } else return null;
145
- }
146
- };
147
- //#endregion
148
- export { j as t };
149
-
150
- //# sourceMappingURL=main-CKSQT8xs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main-CKSQT8xs.js","names":[],"sources":["../../src/delivery/main.tsx"],"sourcesContent":["// @ts-nocheck\n\nimport React from 'react';\nimport { styled } from '@mui/material/styles';\nimport ListItem from '@mui/material/ListItem';\nimport List from '@mui/material/List';\nimport Collapse from '@mui/material/Collapse';\nimport { color, createUniqueId, UiLayout as UiLayoutImport } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport PropTypes from 'prop-types';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst StyledUiLayout: any = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n // apply styles to tables to match the rest of the UI\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '8px 12px',\n textAlign: 'left',\n },\n // reset paragraph margins and line-height inside lists to override client styles\n '& ul p, & ol p': {\n marginBottom: 0,\n marginTop: 0,\n lineHeight: 'normal',\n },\n});\n\nconst StyledListItem: any = styled(ListItem)({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n padding: '12px 0px',\n});\n\nconst Text: any = styled('div')({\n color: color.text(),\n});\n\nconst TitleText: any = styled('h3')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: '700',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst SampleTitleText: any = styled('h4')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: 'normal',\n margin: 0,\n paddingBottom: '6px',\n});\n\n// A native button handles Enter and Space without scrolling the page; the resets drop the\n// browser's button chrome and keep it full width.\nconst RubricToggle: any = styled('button')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n padding: 0,\n border: 0,\n background: 'transparent',\n font: 'inherit',\n textAlign: 'inherit',\n cursor: 'pointer',\n userSelect: 'none',\n fontSize: theme.typography.fontSize,\n fontWeight: '500',\n color: color.tertiary(),\n margin: 0,\n minHeight: 24,\n}));\n\nconst ChevronStyle: any = styled('span')({\n display: 'inline-flex',\n transition: 'transform 0.2s',\n marginLeft: 2,\n alignSelf: 'center',\n});\n\nconst HiddenScreenReader: any = styled('h2')({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0,0,0,0)',\n border: 0,\n whiteSpace: 'nowrap',\n});\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n animationsDisabled: PropTypes.bool,\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n idPrefix = createUniqueId('rubric');\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n model: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n }\n\n shouldRenderPoint: any = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { model, value } = this.props;\n let { animationsDisabled } = this.props;\n animationsDisabled = animationsDisabled || value.animationsDisabled;\n\n if (value && value.points) {\n const { extraCSSRules } = model || {};\n const { points, sampleAnswers } = value;\n\n const rubricList = (\n <List>\n {points\n .slice(0)\n .reverse()\n .map((desc, index) => {\n index = points.length - index - 1;\n const pointsLabel = value.excludeZero ? index + 1 : index;\n\n return (\n <React.Fragment key={index}>\n <StyledListItem key={`P${index}`}>\n <TitleText>\n {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}\n </TitleText>\n <Text dangerouslySetInnerHTML={{ __html: desc }} />\n </StyledListItem>\n\n {sampleAnswers && sampleAnswers[index] && (\n <StyledListItem key={`S${index}`}>\n <SampleTitleText>\n Sample Answer\n </SampleTitleText>\n <Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n </StyledListItem>\n )}\n </React.Fragment>\n );\n })}\n </List>\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules}>\n {/* screen reader only heading for navigation as per PD-5057 */}\n <HiddenScreenReader>{translator.t('rubric.rubric', { lng: value.language })}</HiddenScreenReader>\n {!animationsDisabled ? (\n <React.Fragment>\n <RubricToggle\n type=\"button\"\n id={`${this.idPrefix}-toggle`}\n aria-expanded={this.state.rubricOpen}\n aria-controls={`${this.idPrefix}-content`}\n onClick={this.toggleRubric}\n >\n {translator.t(this.state.rubricOpen ? 'rubric.hideRubric' : 'rubric.showRubric', {\n lng: value.language,\n })}\n <ChevronStyle aria-hidden=\"true\">\n {this.state.rubricOpen ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n )}\n </ChevronStyle>\n </RubricToggle>\n <Collapse\n id={`${this.idPrefix}-content`}\n in={this.state.rubricOpen}\n timeout={{ enter: 225, exit: 195 }}\n >\n {rubricList}\n </Collapse>\n </React.Fragment>\n ) : (\n rubricList\n )}\n </StyledUiLayout>\n );\n } else {\n return null;\n }\n }\n}\n\nexport default Rubric;\n"],"mappings":";;;;;;AASA,SAAS,EAA6B,GAAY;CAChD,OACE,OAAO,KAAU,cAChB,OAAO,KAAU,cAAY,KAAkB,OAAO,EAAM,YAAa;AAE9E;AAEA,SAAS,EAAyB,GAAkB,GAAsB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