@pie-element/match 11.1.0-next.0 → 11.1.2-next.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/match-controller",
3
3
  "private": true,
4
- "version": "9.1.0-next.0",
4
+ "version": "9.1.1-next.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -9,8 +9,8 @@
9
9
  "test": "./node_modules/.bin/jest"
10
10
  },
11
11
  "dependencies": {
12
- "@pie-lib/controller-utils": "1.1.1-next.1",
13
- "@pie-lib/feedback": "1.1.1-next.1",
12
+ "@pie-lib/controller-utils": "1.2.0-next.3",
13
+ "@pie-lib/feedback": "1.2.0-next.3",
14
14
  "debug": "^4.1.1"
15
15
  },
16
16
  "devDependencies": {
@@ -139,6 +139,9 @@ class AnswerGrid extends _react.default.Component {
139
139
  },
140
140
  '&:hover': {
141
141
  color: disabled ? _renderUi.color.disabled() : _renderUi.color.primaryLight()
142
+ },
143
+ '&.Mui-disabled': {
144
+ color: `${showCorrect && rowItem === true || evaluate && this.answerIsCorrect(row.id, rowItem, answerIndex) ? _renderUi.color.correct() : evaluate && this.answerIsIncorrect(row.id, rowItem, answerIndex) ? _renderUi.color.incorrect() : rowItem === true && !evaluate ? _renderUi.color.primary() : _renderUi.color.disabled()}`
142
145
  }
143
146
  },
144
147
  disabled: disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"answer-grid.js","names":["_react","_interopRequireDefault","require","_propTypes","_Radio","_Checkbox","_Typography","_styles","_renderUi","ControlsContainer","styled","theme","marginLeft","marginRight","marginTop","spacing","marginBottom","Column","padding","EmptyTypography","Typography","margin","RowHeader","RowItem","isQuestionText","textAlign","Separator","border","borderTop","color","primaryLight","width","Table","text","backgroundColor","background","borderCollapse","borderSpacing","AnswerGrid","React","Component","constructor","args","_defineProperty2","default","rowId","answerIndex","event","onAnswerChange","choiceMode","answers","props","newAnswers","i","length","target","checked","rowValue","rowValueIndex","correctAnswers","render","showCorrect","headers","rows","disabled","view","Tag","Radio","Checkbox","evaluate","createElement","component","map","header","idx","key","scope","dangerouslySetInnerHTML","__html","row","role","title","id","rowItem","sx","answerIsCorrect","correct","answerIsIncorrect","incorrect","primary","cursor","pointerEvents","opacity","onChange","onRowValueChange","exports","PropTypes","object","bool","isRequired","func","string","array","_default"],"sources":["../src/answer-grid.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Radio from '@mui/material/Radio';\nimport Checkbox from '@mui/material/Checkbox';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst ControlsContainer = styled('div')(({ theme }) => ({\n marginLeft: 'auto',\n marginRight: 'auto',\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}));\n\nconst Column = styled('td')({\n padding: '5px 0',\n});\n\nconst EmptyTypography = styled(Typography)(({ theme }) => ({\n margin: theme.spacing(2),\n}));\n\nconst RowHeader = styled('th')({\n padding: 0,\n});\n\nconst RowItem = styled('div')(({ theme, isQuestionText }) => ({\n padding: theme.spacing(1.5),\n textAlign: isQuestionText ? 'left' : 'center',\n}));\n\nconst Separator = styled('tr')({\n border: 0,\n borderTop: `2.5px solid ${color.primaryLight()}`,\n width: '100%',\n});\n\nconst Table = styled('table')({\n color: color.text(),\n backgroundColor: color.background(),\n borderCollapse: 'collapse',\n borderSpacing: 0,\n marginBottom: 0,\n});\n\nexport class AnswerGrid extends React.Component {\n static propTypes = {\n correctAnswers: PropTypes.object,\n view: PropTypes.bool.isRequired,\n showCorrect: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n onAnswerChange: PropTypes.func.isRequired,\n choiceMode: PropTypes.string.isRequired,\n rows: PropTypes.array.isRequired,\n headers: PropTypes.array.isRequired,\n answers: PropTypes.object.isRequired,\n };\n\n onRowValueChange = (rowId, answerIndex) => (event) => {\n const { onAnswerChange, choiceMode, answers } = this.props;\n const newAnswers = { ...answers };\n\n if (choiceMode === 'radio') {\n for (let i = 0; i < newAnswers[rowId].length; i++) {\n newAnswers[rowId][i] = false;\n }\n }\n\n newAnswers[rowId][answerIndex] = event.target.checked;\n\n onAnswerChange(newAnswers);\n };\n\n answerIsCorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return correctAnswers[rowId][rowValueIndex] === rowValue && rowValue === true;\n };\n\n // needs a separate method because what isn't correct isn't necessarily incorrect\n answerIsIncorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return (\n (correctAnswers[rowId][rowValueIndex] === true && rowValue === false) ||\n (correctAnswers[rowId][rowValueIndex] === false && rowValue === true)\n );\n };\n\n render() {\n const { showCorrect, headers, rows, choiceMode, answers, disabled, view } = this.props;\n const Tag = choiceMode === 'radio' ? Radio : Checkbox;\n const evaluate = disabled && !view;\n\n if (!rows || rows.length === 0) {\n return (\n <ControlsContainer>\n <EmptyTypography component=\"div\">\n There are currently no questions to show.\n </EmptyTypography>\n </ControlsContainer>\n );\n }\n\n return (\n <ControlsContainer>\n <Table>\n <colgroup>\n {(headers || []).map((header, idx) => (\n <col key={`col-${idx}`} />\n ))}\n </colgroup>\n\n <thead>\n <tr>\n {(headers || []).map((header, idx) => (\n <RowHeader key={`th-${idx}`} data-colno={`${idx}`} scope=\"row\">\n <RowItem\n isQuestionText={idx === 0}\n dangerouslySetInnerHTML={{ __html: header }}\n />\n </RowHeader>\n ))}\n </tr>\n </thead>\n\n {(rows || []).map((row, idx) => (\n <tbody key={`row-${idx}`} role=\"group\">\n <Separator>\n <td key={`td-title-${idx}`} data-colno={'0'}>\n <RowItem\n isQuestionText={true}\n dangerouslySetInnerHTML={{ __html: row.title }}\n />\n </td>\n\n {(answers[row.id] || []).map((rowItem, answerIndex) => (\n <Column key={`td-${idx}-${answerIndex}`} data-colno={`${answerIndex + 1}`}>\n <RowItem>\n <Tag\n sx={{\n padding: '6px',\n color: (showCorrect && rowItem === true) ||\n (evaluate && this.answerIsCorrect(row.id, rowItem, answerIndex)) \n ? color.correct() :\n evaluate && this.answerIsIncorrect(row.id, rowItem, answerIndex)\n ? color.incorrect() :\n rowItem === true && !evaluate\n ? color.primary() :\n disabled \n ? color.disabled() : color.text(),\n cursor: disabled ? 'not-allowed' : 'pointer',\n pointerEvents: disabled ? 'initial' : 'auto',\n opacity: disabled ? 0.7 : 1,\n '& input': {\n width: '100% !important',\n },\n '&:hover': {\n color: disabled ? color.disabled() : color.primaryLight(),\n },\n }}\n disabled={disabled}\n onChange={this.onRowValueChange(row.id, answerIndex)}\n checked={rowItem === true}\n />\n </RowItem>\n </Column>\n ))}\n </Separator>\n </tbody>\n ))}\n </Table>\n </ControlsContainer>\n );\n }\n}\n\nexport default AnswerGrid;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,MAAMO,iBAAiB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACtDC,UAAU,EAAE,MAAM;EAClBC,WAAW,EAAE,MAAM;EACnBC,SAAS,EAAEH,KAAK,CAACI,OAAO,CAAC,CAAC,CAAC;EAC3BC,YAAY,EAAEL,KAAK,CAACI,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,MAAME,MAAM,GAAG,IAAAP,cAAM,EAAC,IAAI,CAAC,CAAC;EAC1BQ,OAAO,EAAE;AACX,CAAC,CAAC;AAEF,MAAMC,eAAe,GAA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AM,CAACE;AAC5B,CAAC;AAAA,IAAAI,QAAA,GAAAR,OAAA,CAAAnD,OAAA,GAyHYN,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"answer-grid.js","names":["_react","_interopRequireDefault","require","_propTypes","_Radio","_Checkbox","_Typography","_styles","_renderUi","ControlsContainer","styled","theme","marginLeft","marginRight","marginTop","spacing","marginBottom","Column","padding","EmptyTypography","Typography","margin","RowHeader","RowItem","isQuestionText","textAlign","Separator","border","borderTop","color","primaryLight","width","Table","text","backgroundColor","background","borderCollapse","borderSpacing","AnswerGrid","React","Component","constructor","args","_defineProperty2","default","rowId","answerIndex","event","onAnswerChange","choiceMode","answers","props","newAnswers","i","length","target","checked","rowValue","rowValueIndex","correctAnswers","render","showCorrect","headers","rows","disabled","view","Tag","Radio","Checkbox","evaluate","createElement","component","map","header","idx","key","scope","dangerouslySetInnerHTML","__html","row","role","title","id","rowItem","sx","answerIsCorrect","correct","answerIsIncorrect","incorrect","primary","cursor","pointerEvents","opacity","onChange","onRowValueChange","exports","PropTypes","object","bool","isRequired","func","string","array","_default"],"sources":["../src/answer-grid.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Radio from '@mui/material/Radio';\nimport Checkbox from '@mui/material/Checkbox';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst ControlsContainer = styled('div')(({ theme }) => ({\n marginLeft: 'auto',\n marginRight: 'auto',\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}));\n\nconst Column = styled('td')({\n padding: '5px 0',\n});\n\nconst EmptyTypography = styled(Typography)(({ theme }) => ({\n margin: theme.spacing(2),\n}));\n\nconst RowHeader = styled('th')({\n padding: 0,\n});\n\nconst RowItem = styled('div')(({ theme, isQuestionText }) => ({\n padding: theme.spacing(1.5),\n textAlign: isQuestionText ? 'left' : 'center',\n}));\n\nconst Separator = styled('tr')({\n border: 0,\n borderTop: `2.5px solid ${color.primaryLight()}`,\n width: '100%',\n});\n\nconst Table = styled('table')({\n color: color.text(),\n backgroundColor: color.background(),\n borderCollapse: 'collapse',\n borderSpacing: 0,\n marginBottom: 0,\n});\n\nexport class AnswerGrid extends React.Component {\n static propTypes = {\n correctAnswers: PropTypes.object,\n view: PropTypes.bool.isRequired,\n showCorrect: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n onAnswerChange: PropTypes.func.isRequired,\n choiceMode: PropTypes.string.isRequired,\n rows: PropTypes.array.isRequired,\n headers: PropTypes.array.isRequired,\n answers: PropTypes.object.isRequired,\n };\n\n onRowValueChange = (rowId, answerIndex) => (event) => {\n const { onAnswerChange, choiceMode, answers } = this.props;\n const newAnswers = { ...answers };\n\n if (choiceMode === 'radio') {\n for (let i = 0; i < newAnswers[rowId].length; i++) {\n newAnswers[rowId][i] = false;\n }\n }\n\n newAnswers[rowId][answerIndex] = event.target.checked;\n\n onAnswerChange(newAnswers);\n };\n\n answerIsCorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return correctAnswers[rowId][rowValueIndex] === rowValue && rowValue === true;\n };\n\n // needs a separate method because what isn't correct isn't necessarily incorrect\n answerIsIncorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return (\n (correctAnswers[rowId][rowValueIndex] === true && rowValue === false) ||\n (correctAnswers[rowId][rowValueIndex] === false && rowValue === true)\n );\n };\n\n render() {\n const { showCorrect, headers, rows, choiceMode, answers, disabled, view } = this.props;\n const Tag = choiceMode === 'radio' ? Radio : Checkbox;\n const evaluate = disabled && !view;\n\n if (!rows || rows.length === 0) {\n return (\n <ControlsContainer>\n <EmptyTypography component=\"div\">\n There are currently no questions to show.\n </EmptyTypography>\n </ControlsContainer>\n );\n }\n\n return (\n <ControlsContainer>\n <Table>\n <colgroup>\n {(headers || []).map((header, idx) => (\n <col key={`col-${idx}`} />\n ))}\n </colgroup>\n\n <thead>\n <tr>\n {(headers || []).map((header, idx) => (\n <RowHeader key={`th-${idx}`} data-colno={`${idx}`} scope=\"row\">\n <RowItem\n isQuestionText={idx === 0}\n dangerouslySetInnerHTML={{ __html: header }}\n />\n </RowHeader>\n ))}\n </tr>\n </thead>\n\n {(rows || []).map((row, idx) => (\n <tbody key={`row-${idx}`} role=\"group\">\n <Separator>\n <td key={`td-title-${idx}`} data-colno={'0'}>\n <RowItem\n isQuestionText={true}\n dangerouslySetInnerHTML={{ __html: row.title }}\n />\n </td>\n\n {(answers[row.id] || []).map((rowItem, answerIndex) => (\n <Column key={`td-${idx}-${answerIndex}`} data-colno={`${answerIndex + 1}`}>\n <RowItem>\n <Tag\n sx={{\n padding: '6px',\n color: (showCorrect && rowItem === true) ||\n (evaluate && this.answerIsCorrect(row.id, rowItem, answerIndex)) \n ? color.correct() :\n evaluate && this.answerIsIncorrect(row.id, rowItem, answerIndex)\n ? color.incorrect() :\n rowItem === true && !evaluate\n ? color.primary() :\n disabled \n ? color.disabled() : color.text(),\n cursor: disabled ? 'not-allowed' : 'pointer',\n pointerEvents: disabled ? 'initial' : 'auto',\n opacity: disabled ? 0.7 : 1,\n '& input': {\n width: '100% !important',\n },\n '&:hover': {\n color: disabled ? color.disabled() : color.primaryLight(),\n },\n '&.Mui-disabled': {\n color: `${(showCorrect && rowItem === true) ||\n (evaluate && this.answerIsCorrect(row.id, rowItem, answerIndex)) \n ? color.correct() :\n evaluate && this.answerIsIncorrect(row.id, rowItem, answerIndex)\n ? color.incorrect() :\n rowItem === true && !evaluate\n ? color.primary() :\n color.disabled()}`,\n },\n }}\n disabled={disabled}\n onChange={this.onRowValueChange(row.id, answerIndex)}\n checked={rowItem === true}\n />\n </RowItem>\n </Column>\n ))}\n </Separator>\n </tbody>\n ))}\n </Table>\n </ControlsContainer>\n );\n }\n}\n\nexport default AnswerGrid;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAA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,10 @@
1
1
  {
2
2
  "name": "@pie-element/match",
3
- "repository": {
4
- "type": "git",
5
- "url": "https://github.com/pie-framework/pie-elements"
6
- },
3
+ "repository": "pie-framework/pie-elements",
7
4
  "publishConfig": {
8
5
  "access": "public"
9
6
  },
10
- "version": "11.1.0-next.0+20d879b",
7
+ "version": "11.1.2-next.2",
11
8
  "main": "lib/index.js",
12
9
  "description": "",
13
10
  "scripts": {
@@ -19,10 +16,10 @@
19
16
  "@mui/icons-material": "^7.3.4",
20
17
  "@mui/material": "^7.3.4",
21
18
  "@pie-framework/pie-player-events": "^0.1.0",
22
- "@pie-lib/correct-answer-toggle": "3.1.1-next.1",
23
- "@pie-lib/math-rendering": "4.1.1-next.1",
24
- "@pie-lib/render-ui": "5.1.1-next.1",
25
- "@pie-lib/test-utils": "1.1.1-next.1",
19
+ "@pie-lib/correct-answer-toggle": "3.2.0-next.4",
20
+ "@pie-lib/math-rendering": "4.2.0-next.3",
21
+ "@pie-lib/render-ui": "5.2.0-next.4",
22
+ "@pie-lib/test-utils": "1.2.0-next.3",
26
23
  "classnames": "^2.2.5",
27
24
  "debug": "^4.1.1",
28
25
  "lodash-es": "^4.17.23",
@@ -32,6 +29,6 @@
32
29
  },
33
30
  "author": "",
34
31
  "license": "ISC",
35
- "gitHead": "20d879b8b8fa74decf5028d860d54cd09cbdf051",
32
+ "gitHead": "a29aff6c2f994c4e4b4847f67a5e9f2928e703af",
36
33
  "module": "src/index.js"
37
34
  }