@pie-element/match-list 7.1.9 → 7.2.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 +11 -0
- package/lib/answer-area.js +3 -4
- package/lib/answer-area.js.map +1 -1
- package/lib/answer.js +1 -2
- package/lib/answer.js.map +1 -1
- package/lib/arrow.js +8 -3
- package/lib/arrow.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [7.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/match-list@7.1.9...@pie-element/match-list@7.2.0) (2026-08-21)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- move [@pie-lib](https://github.com/pie-lib) deps back to latest, off next prereleases PIE-927 ([a53e012](https://github.com/pie-framework/pie-elements/commit/a53e0127eb4ac95ece54e1e2bd669ae4974f4251))
|
|
11
|
+
- **theming:** move the grey palette reads onto --pie-\* tokens PIE-856 ([d7d005b](https://github.com/pie-framework/pie-elements/commit/d7d005bf081843335b4b0377852f2ecd075cb62d)), closes [#000000](https://github.com/pie-framework/pie-elements/issues/000000) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#646464](https://github.com/pie-framework/pie-elements/issues/646464) [#616161](https://github.com/pie-framework/pie-elements/issues/616161) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#C0C3](https://github.com/pie-framework/pie-elements/issues/C0C3)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- bump libs PIE-856, PIE-681, PIE-927 ([cb26d7a](https://github.com/pie-framework/pie-elements/commit/cb26d7afa6c99522533c321d5ff8ce3148a66e9e))
|
|
16
|
+
|
|
6
17
|
## [7.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/match-list@7.1.8...@pie-element/match-list@7.1.9) (2026-08-19)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @pie-element/match-list
|
package/lib/answer-area.js
CHANGED
|
@@ -12,6 +12,7 @@ var _styles = require("@mui/material/styles");
|
|
|
12
12
|
var _lodashEs = require("lodash-es");
|
|
13
13
|
var _arrow = _interopRequireDefault(require("./arrow"));
|
|
14
14
|
var _answer = _interopRequireDefault(require("./answer"));
|
|
15
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
15
16
|
// matches the min width of the answer entries (see AnswerContainer in ./answer), so the two columns
|
|
16
17
|
// give the row an intrinsic min width that the horizontal scroll container can overflow.
|
|
17
18
|
const MIN_COLUMN_WIDTH = 200;
|
|
@@ -33,10 +34,8 @@ const ItemList = (0, _styles.styled)('div')(({
|
|
|
33
34
|
marginTop: theme.spacing(2),
|
|
34
35
|
marginBottom: theme.spacing(2)
|
|
35
36
|
}));
|
|
36
|
-
const PromptEntry = (0, _styles.styled)('div')(({
|
|
37
|
-
|
|
38
|
-
}) => ({
|
|
39
|
-
border: `1px solid ${theme.palette.grey[400]}`,
|
|
37
|
+
const PromptEntry = (0, _styles.styled)('div')(() => ({
|
|
38
|
+
border: `1px solid ${_renderUi.color.border()}`,
|
|
40
39
|
boxSizing: 'border-box',
|
|
41
40
|
flex: 1,
|
|
42
41
|
margin: '10px 0',
|
package/lib/answer-area.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-area.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_lodashEs","_arrow","_answer","MIN_COLUMN_WIDTH","ArrowEntry","styled","alignItems","display","flexShrink","height","margin","ItemList","theme","flex","flexDirection","justifyContent","marginTop","spacing","marginBottom","PromptEntry","border","palette","grey","boxSizing","minHeight","minWidth","overflow","padding","textAlign","width","wordBreak","Row","AnswerArea","React","Component","constructor","args","_defineProperty2","default","promptId","model","session","showCorrect","props","config","answerId","prompts","find","p","id","relatedAnswer","value","answer","answers","sessionValue","reduce","obj","prompt","undefined","mode","correctPromptMap","isUndefined","val","key","map","sessionAnswer","getAnswerFromSession","render","disabled","instanceId","onRemoveAnswer","selectedAnswer","onChoiceClick","onPlacementClick","rows","buildRows","correctnessMap","getCorrectOrIncorrectMap","createElement","title","index","dangerouslySetInnerHTML","__html","direction","className","correct","draggable","isEmpty","type","onRemoveChoice","onSelectClick","exports","PropTypes","object","isRequired","bool","onSessionChange","func","string","_default"],"sources":["../src/answer-area.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { isEmpty, isUndefined, reduce } from 'lodash-es';\n\nimport Arrow from './arrow';\nimport DragAndDropAnswer from './answer';\n\n// matches the min width of the answer entries (see AnswerContainer in ./answer), so the two columns\n// give the row an intrinsic min width that the horizontal scroll container can overflow.\nconst MIN_COLUMN_WIDTH = 200;\n\nconst ArrowEntry = styled('div')({\n alignItems: 'normal',\n display: 'flex',\n flexShrink: 0,\n height: 40,\n margin: '10px 20px',\n});\n\nconst ItemList = styled('div')(({ theme }) => ({\n alignItems: 'flex-start',\n display: 'flex',\n flex: 1,\n flexDirection: 'column',\n justifyContent: 'space-between',\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst PromptEntry = styled('div')(({ theme }) => ({\n border: `1px solid ${theme.palette.grey[400]}`,\n boxSizing: 'border-box',\n flex: 1,\n margin: '10px 0',\n minHeight: 40,\n minWidth: MIN_COLUMN_WIDTH,\n overflow: 'hidden',\n padding: 10,\n textAlign: 'center',\n width: '100%',\n wordBreak: 'break-word',\n}));\n\nconst Row = styled('div')({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n});\n\nexport class AnswerArea extends React.Component {\n static propTypes = {\n session: PropTypes.object.isRequired,\n showCorrect: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n onSessionChange: PropTypes.func,\n onRemoveAnswer: PropTypes.func,\n instanceId: PropTypes.string.isRequired,\n model: PropTypes.object.isRequired,\n prompt: PropTypes.string,\n selectedAnswer: PropTypes.object,\n onChoiceClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n };\n\n getAnswerFromSession = (promptId) => {\n const { model, session, showCorrect } = this.props;\n const { config } = model;\n const answerId = showCorrect\n ? config.prompts.find((p) => p.id === promptId).relatedAnswer\n : session.value && session.value[promptId];\n const answer = config.answers.find((answer) => answer.id === answerId);\n\n return answer || {};\n };\n\n getCorrectOrIncorrectMap = () => {\n const { model, session, showCorrect } = this.props;\n const { config } = model;\n const sessionValue =\n session.value ||\n config.prompts.reduce((obj, prompt) => {\n obj[prompt.id] = undefined;\n return obj;\n }, {});\n\n if (model.mode !== 'evaluate') {\n return {};\n }\n\n if (showCorrect) {\n return config.prompts.reduce((obj, prompt) => {\n obj[prompt.id] = true;\n\n return obj;\n }, {});\n }\n\n const correctPromptMap = config.prompts.reduce((obj, prompt) => {\n if (!isUndefined(prompt.relatedAnswer)) {\n obj[prompt.id] = prompt.relatedAnswer;\n }\n\n return obj;\n }, {});\n\n return reduce(\n sessionValue,\n (obj, val, key) => {\n obj[key] = correctPromptMap[key] === sessionValue[key];\n\n return obj;\n },\n {},\n );\n };\n\n buildRows = () => {\n const { model } = this.props;\n const { config } = model;\n const prompts = config.prompts || [];\n\n return prompts.map((prompt) => {\n const sessionAnswer = this.getAnswerFromSession(prompt.id);\n\n return {\n ...prompt,\n sessionAnswer,\n };\n });\n };\n\n render() {\n const { disabled, instanceId, onRemoveAnswer, selectedAnswer, onChoiceClick, onPlacementClick } = this.props;\n const rows = this.buildRows();\n const correctnessMap = this.getCorrectOrIncorrectMap();\n\n return (\n <ItemList>\n {rows.map(({ sessionAnswer, title, id }, index) => {\n return (\n <Row key={index}>\n <PromptEntry dangerouslySetInnerHTML={{ __html: title }} />\n\n <ArrowEntry>\n <Arrow direction=\"left\" />\n <Arrow />\n </ArrowEntry>\n\n <DragAndDropAnswer\n key={index}\n className=\"answer\"\n index={index}\n promptId={id}\n correct={correctnessMap[id]}\n draggable={!isEmpty(sessionAnswer)}\n disabled={disabled}\n instanceId={instanceId}\n id={sessionAnswer.id}\n title={sessionAnswer.title}\n type={'target'}\n onRemoveChoice={() => onRemoveAnswer(id)}\n selectedAnswer={selectedAnswer}\n onSelectClick={onChoiceClick}\n onPlacementClick={onPlacementClick}\n />\n </Row>\n );\n })}\n </ItemList>\n );\n }\n}\n\nexport default AnswerArea;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA,MAAMM,gBAAgB,GAAG,GAAG;AAE5B,MAAMC,UAAU,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAC/BC,UAAU,EAAE,QAAQ;EACpBC,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,CAAC;EACbC,MAAM,EAAE,EAAE;EACVC,MAAM,EAAE;AACV,CAAC,CAAC;AAEF,MAAMC,QAAQ,GAAG,IAAAN,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEO;AAAM,CAAC,MAAM;EAC7CN,UAAU,EAAE,YAAY;EACxBC,OAAO,EAAE,MAAM;EACfM,IAAI,EAAE,CAAC;EACPC,aAAa,EAAE,QAAQ;EACvBC,cAAc,EAAE,eAAe;EAC/BC,SAAS,EAAEJ,KAAK,CAACK,OAAO,CAAC,CAAC,CAAC;EAC3BC,YAAY,EAAEN,KAAK,CAACK,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,MAAME,WAAW,GAAG,IAAAd,cAAM,EAAC,KAAK,CAAC,C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U;EAClCrC,MAAM,EAAEmC,kBAAS,CAACM,MAAM;EACxB3B,cAAc,EAAEqB,kBAAS,CAACC,MAAM;EAChCrB,aAAa,EAAEoB,kBAAS,CAACK,IAAI;EAC7BxB,gBAAgB,EAAEmB,kBAAS,CAACK;AAC9B,CAAC;AAAA,IAAAE,QAAA,GAAAR,OAAA,CAAArD,OAAA,GA+GYN,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"answer-area.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_lodashEs","_arrow","_answer","_renderUi","MIN_COLUMN_WIDTH","ArrowEntry","styled","alignItems","display","flexShrink","height","margin","ItemList","theme","flex","flexDirection","justifyContent","marginTop","spacing","marginBottom","PromptEntry","border","color","boxSizing","minHeight","minWidth","overflow","padding","textAlign","width","wordBreak","Row","AnswerArea","React","Component","constructor","args","_defineProperty2","default","promptId","model","session","showCorrect","props","config","answerId","prompts","find","p","id","relatedAnswer","value","answer","answers","sessionValue","reduce","obj","prompt","undefined","mode","correctPromptMap","isUndefined","val","key","map","sessionAnswer","getAnswerFromSession","render","disabled","instanceId","onRemoveAnswer","selectedAnswer","onChoiceClick","onPlacementClick","rows","buildRows","correctnessMap","getCorrectOrIncorrectMap","createElement","title","index","dangerouslySetInnerHTML","__html","direction","className","correct","draggable","isEmpty","type","onRemoveChoice","onSelectClick","exports","PropTypes","object","isRequired","bool","onSessionChange","func","string","_default"],"sources":["../src/answer-area.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { isEmpty, isUndefined, reduce } from 'lodash-es';\n\nimport Arrow from './arrow';\nimport DragAndDropAnswer from './answer';\nimport { color } from '@pie-lib/render-ui';\n\n// matches the min width of the answer entries (see AnswerContainer in ./answer), so the two columns\n// give the row an intrinsic min width that the horizontal scroll container can overflow.\nconst MIN_COLUMN_WIDTH = 200;\n\nconst ArrowEntry = styled('div')({\n alignItems: 'normal',\n display: 'flex',\n flexShrink: 0,\n height: 40,\n margin: '10px 20px',\n});\n\nconst ItemList = styled('div')(({ theme }) => ({\n alignItems: 'flex-start',\n display: 'flex',\n flex: 1,\n flexDirection: 'column',\n justifyContent: 'space-between',\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst PromptEntry = styled('div')(() => ({\n border: `1px solid ${color.border()}`,\n boxSizing: 'border-box',\n flex: 1,\n margin: '10px 0',\n minHeight: 40,\n minWidth: MIN_COLUMN_WIDTH,\n overflow: 'hidden',\n padding: 10,\n textAlign: 'center',\n width: '100%',\n wordBreak: 'break-word',\n}));\n\nconst Row = styled('div')({\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n});\n\nexport class AnswerArea extends React.Component {\n static propTypes = {\n session: PropTypes.object.isRequired,\n showCorrect: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n onSessionChange: PropTypes.func,\n onRemoveAnswer: PropTypes.func,\n instanceId: PropTypes.string.isRequired,\n model: PropTypes.object.isRequired,\n prompt: PropTypes.string,\n selectedAnswer: PropTypes.object,\n onChoiceClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n };\n\n getAnswerFromSession = (promptId) => {\n const { model, session, showCorrect } = this.props;\n const { config } = model;\n const answerId = showCorrect\n ? config.prompts.find((p) => p.id === promptId).relatedAnswer\n : session.value && session.value[promptId];\n const answer = config.answers.find((answer) => answer.id === answerId);\n\n return answer || {};\n };\n\n getCorrectOrIncorrectMap = () => {\n const { model, session, showCorrect } = this.props;\n const { config } = model;\n const sessionValue =\n session.value ||\n config.prompts.reduce((obj, prompt) => {\n obj[prompt.id] = undefined;\n return obj;\n }, {});\n\n if (model.mode !== 'evaluate') {\n return {};\n }\n\n if (showCorrect) {\n return config.prompts.reduce((obj, prompt) => {\n obj[prompt.id] = true;\n\n return obj;\n }, {});\n }\n\n const correctPromptMap = config.prompts.reduce((obj, prompt) => {\n if (!isUndefined(prompt.relatedAnswer)) {\n obj[prompt.id] = prompt.relatedAnswer;\n }\n\n return obj;\n }, {});\n\n return reduce(\n sessionValue,\n (obj, val, key) => {\n obj[key] = correctPromptMap[key] === sessionValue[key];\n\n return obj;\n },\n {},\n );\n };\n\n buildRows = () => {\n const { model } = this.props;\n const { config } = model;\n const prompts = config.prompts || [];\n\n return prompts.map((prompt) => {\n const sessionAnswer = this.getAnswerFromSession(prompt.id);\n\n return {\n ...prompt,\n sessionAnswer,\n };\n });\n };\n\n render() {\n const { disabled, instanceId, onRemoveAnswer, selectedAnswer, onChoiceClick, onPlacementClick } = this.props;\n const rows = this.buildRows();\n const correctnessMap = this.getCorrectOrIncorrectMap();\n\n return (\n <ItemList>\n {rows.map(({ sessionAnswer, title, id }, index) => {\n return (\n <Row key={index}>\n <PromptEntry dangerouslySetInnerHTML={{ __html: title }} />\n\n <ArrowEntry>\n <Arrow direction=\"left\" />\n <Arrow />\n </ArrowEntry>\n\n <DragAndDropAnswer\n key={index}\n className=\"answer\"\n index={index}\n promptId={id}\n correct={correctnessMap[id]}\n draggable={!isEmpty(sessionAnswer)}\n disabled={disabled}\n instanceId={instanceId}\n id={sessionAnswer.id}\n title={sessionAnswer.title}\n type={'target'}\n onRemoveChoice={() => onRemoveAnswer(id)}\n selectedAnswer={selectedAnswer}\n onSelectClick={onChoiceClick}\n onPlacementClick={onPlacementClick}\n />\n </Row>\n );\n })}\n </ItemList>\n );\n }\n}\n\nexport default AnswerArea;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA;AACA;AACA,MAAMO,gBAAgB,GAAG,GAAG;AAE5B,MA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/BmB,aAAa,EAAElB,aAAc;QAC7BC,gBAAgB,EAAEA;MAAiB,CACpC,CACE,CAAC;IAEV,CAAC,CACO,CAAC;EAEf;AACF;AAACkB,OAAA,CAAA3D,UAAA,GAAAA,UAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EA1HYN,UAAU,eACF;EACjBS,OAAO,EAAEmD,kBAAS,CAACC,MAAM,CAACC,UAAU;EACpCpD,WAAW,EAAEkD,kBAAS,CAACG,IAAI,CAACD,UAAU;EACtC1B,QAAQ,EAAEwB,kBAAS,CAACG,IAAI,CAACD,UAAU;EACnCE,eAAe,EAAEJ,kBAAS,CAACK,IAAI;EAC/B3B,cAAc,EAAEsB,kBAAS,CAACK,IAAI;EAC9B5B,UAAU,EAAEuB,kBAAS,CAACM,MAAM,CAACJ,UAAU;EACvCtD,KAAK,EAAEoD,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClCrC,MAAM,EAAEmC,kBAAS,CAACM,MAAM;EACxB3B,cAAc,EAAEqB,kBAAS,CAACC,MAAM;EAChCrB,aAAa,EAAEoB,kBAAS,CAACK,IAAI;EAC7BxB,gBAAgB,EAAEmB,kBAAS,CAACK;AAC9B,CAAC;AAAA,IAAAE,QAAA,GAAAR,OAAA,CAAArD,OAAA,GA+GYN,UAAU","ignoreList":[]}
|
package/lib/answer.js
CHANGED
|
@@ -49,7 +49,6 @@ Holder.propTypes = {
|
|
|
49
49
|
type: _propTypes.default.string
|
|
50
50
|
};
|
|
51
51
|
const AnswerContentContainer = (0, _styles.styled)('div')(({
|
|
52
|
-
theme,
|
|
53
52
|
isDragging,
|
|
54
53
|
isSelected,
|
|
55
54
|
isOver,
|
|
@@ -58,7 +57,7 @@ const AnswerContentContainer = (0, _styles.styled)('div')(({
|
|
|
58
57
|
}) => ({
|
|
59
58
|
color: _renderUi.color.text(),
|
|
60
59
|
backgroundColor: _renderUi.color.white(),
|
|
61
|
-
border: `1px solid ${outcome === 'correct' ? _renderUi.color.correct() : outcome === 'incorrect' ? _renderUi.color.incorrect() :
|
|
60
|
+
border: `1px solid ${outcome === 'correct' ? _renderUi.color.correct() : outcome === 'incorrect' ? _renderUi.color.incorrect() : _renderUi.color.border()}`,
|
|
62
61
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
63
62
|
width: '100%',
|
|
64
63
|
padding: '10px',
|
package/lib/answer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.js","names":["_core","require","_propTypes","_interopRequireDefault","_react","_interopRequireWildcard","_debug","_styles","_drag","_lodashEs","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","log","debug","HolderNumber","styled","theme","width","fontSize","textAlign","color","palette","common","black","Holder","index","isOver","disabled","type","createElement","PlaceHolder","extraStyles","display","padding","alignItems","justifyContent","height","undefined","propTypes","PropTypes","number","bool","string","AnswerContentContainer","isDragging","isSelected","outcome","text","backgroundColor","white","border","correct","incorrect","grey","cursor","boxSizing","overflow","transition","wordBreak","opacity","touchAction","AnswerContent","props","title","empty","guideIndex","dangerouslySetInnerHTML","__html","AnswerContainer","minHeight","minWidth","margin","spacing","Answer","React","Component","constructor","args","_defineProperty2","componentDidMount","ref","addEventListener","handleTouchStart","passive","componentWillUnmount","removeEventListener","render","id","className","isEmpty","exports","any","DragAndDropAnswer","instanceId","promptId","draggable","selectedAnswer","onSelectClick","onPlacementClick","dragId","dropId","activeData","value","dropZoneData","attributes","listeners","setNodeRef","setDragRef","transform","useDraggable","data","droppable","useDroppable","setDropRef","isHovered","setIsHovered","useState","hasSelection","showsHoverEffect","transformStyle","x","y","handleResponseAreaClick","isNativeTabStop","handleResponseAreaKeyDown","code","preventDefault","role","tabIndex","onClick","onKeyDown","onMouseEnter","onMouseLeave","style","flex","_extends2","handleChoiceClick","stopPropagation","object","func","_default"],"sources":["../src/answer.jsx"],"sourcesContent":["import { useDraggable, useDroppable } from '@dnd-kit/core';\nimport PropTypes from 'prop-types';\nimport React, { useState } from 'react';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { isEmpty } from 'lodash-es';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('pie-elements:match-title:answer');\n\nconst HolderNumber = styled('div')(({ theme }) => ({\n width: '100%',\n fontSize: '18px',\n textAlign: 'center',\n color: `rgba(${theme.palette.common.black}, 0.6)`,\n}));\n\nconst Holder = ({ index, isOver, disabled, type }) => (\n <PlaceHolder\n extraStyles={{\n display: 'flex',\n padding: '0',\n alignItems: 'center',\n justifyContent: 'center',\n height: '40px',\n }}\n disabled={disabled}\n isOver={isOver}\n type={type}\n >\n {index !== undefined && <HolderNumber>{index}</HolderNumber>}\n </PlaceHolder>\n);\n\nHolder.propTypes = {\n index: PropTypes.number,\n isOver: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n};\n\nconst AnswerContentContainer = styled('div')(({ theme, isDragging, isSelected, isOver, disabled, outcome }) => ({\n color: color.text(),\n backgroundColor: color.white(),\n border: `1px solid ${\n outcome === 'correct' ? color.correct() : outcome === 'incorrect' ? color.incorrect() : theme.palette.grey[400]\n }`,\n cursor: disabled ? 'not-allowed' : 'pointer',\n width: '100%',\n padding: '10px',\n boxSizing: 'border-box',\n overflow: 'hidden',\n transition: 'opacity 200ms linear',\n wordBreak: 'break-word',\n opacity: (isDragging || isSelected) && !disabled ? 0.5 : isOver && !disabled ? 0.2 : 1,\n touchAction: 'none',\n}));\n\nconst AnswerContent = (props) => {\n const { isDragging, isSelected, isOver, title, disabled, empty, outcome, guideIndex, type } = props;\n\n if (empty) {\n return <Holder index={guideIndex} isOver={isOver} disabled={disabled} type={type} />;\n } else {\n return (\n <AnswerContentContainer\n isDragging={isDragging}\n isSelected={isSelected}\n isOver={isOver}\n disabled={disabled}\n outcome={outcome}\n dangerouslySetInnerHTML={{ __html: title }}\n />\n );\n }\n};\n\nconst AnswerContainer = styled('div')(({ correct, theme }) => ({\n boxSizing: 'border-box',\n minHeight: 40,\n minWidth: '200px',\n overflow: 'hidden',\n margin: theme.spacing(0.5),\n padding: '0px',\n textAlign: 'center',\n height: 'initial',\n border:\n correct === true\n ? `1px solid var(--feedback-correct-bg-color, ${color.correct()})`\n : correct === false\n ? `1px solid var(--feedback-incorrect-bg-color, ${color.incorrect()})`\n : 'none',\n}));\n\nexport class Answer extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n isDragging: PropTypes.bool,\n isSelected: PropTypes.bool,\n id: PropTypes.any,\n title: PropTypes.string,\n isOver: PropTypes.bool,\n empty: PropTypes.bool,\n type: PropTypes.string,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n };\n\n componentDidMount() {\n if (this.ref) {\n // NOTE: preventing default on touchstart can block dnd-kit pointer handling on some devices.\n // Consider removing this if you have issues on touch devices.\n this.ref.addEventListener('touchstart', this.handleTouchStart, { passive: true });\n }\n }\n\n componentWillUnmount() {\n if (this.ref) {\n this.ref.removeEventListener('touchstart', this.handleTouchStart);\n }\n }\n\n handleTouchStart = (e) => {\n // do NOT call e.preventDefault() here — it prevents pointer events necessary for dnd-kit.\n // Keep this handler empty or remove it if you don't need it.\n // e.preventDefault();\n };\n\n render() {\n const {\n id,\n title,\n isDragging = false,\n isSelected = false,\n className,\n disabled,\n isOver = false,\n type,\n correct,\n } = this.props;\n\n log('[render], props: ', this.props);\n\n return (\n <AnswerContainer correct={correct} className={className} ref={(ref) => (this.ref = ref)}>\n <AnswerContent\n title={title}\n id={id}\n isOver={isOver}\n empty={isEmpty(title)}\n isDragging={isDragging}\n isSelected={isSelected}\n disabled={disabled}\n type={type}\n />\n </AnswerContainer>\n );\n }\n}\n\nfunction DragAndDropAnswer(props) {\n const {\n id,\n instanceId,\n promptId,\n draggable = true,\n disabled = false,\n type,\n selectedAnswer,\n onSelectClick,\n onPlacementClick,\n } = props;\n\n const dragId = `${type || 'answer'}-${id}`;\n // droppable only if promptId exists\n const dropId = promptId !== undefined && promptId !== null ? `drop-${promptId}` : undefined;\n\n // Built once and reused for both dnd-kit's own data and the click handlers below, so\n // a click carries exactly the same shape dnd-kit's onDragStart/onDragEnd would.\n const activeData = {\n type: type || 'answer',\n id,\n instanceId,\n value: props.title,\n promptId,\n };\n const dropZoneData = dropId\n ? {\n type: 'drop-zone',\n promptId,\n instanceId,\n }\n : undefined;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n transition,\n isDragging,\n } = useDraggable({\n id: dragId,\n data: activeData,\n disabled: !draggable || disabled,\n });\n\n const droppable = useDroppable({\n id: dropId,\n data: dropZoneData,\n disabled: disabled || !dropId,\n });\n\n const setDropRef = droppable.setNodeRef;\n const isOver = droppable.isOver;\n\n // dnd-kit's own isOver only reflects real collision detection during an active drag,\n // so it stays false while an answer is merely click-selected (no drag in progress).\n // Track hovering locally and fold it into the same isOver signal used everywhere\n // below, so hovering a response area while something is selected gets the exact same\n // treatment as hovering it during a real drag — one code path, no duplicated CSS.\n const [isHovered, setIsHovered] = useState(false);\n const hasSelection = !!selectedAnswer;\n const showsHoverEffect = isOver || (hasSelection && isHovered && !disabled);\n\n const isSelected =\n !!selectedAnswer &&\n selectedAnswer.type === activeData.type &&\n selectedAnswer.id === activeData.id &&\n selectedAnswer.promptId === activeData.promptId;\n\n // compute style: apply transform to the element that actually moves\n const transformStyle = transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined;\n\n // If this item is a drop-zone (prompt slot), we render an outer droppable wrapper.\n // The outer wrapper's rect is what dnd-kit measures for this slot's own droppable\n // (\"drop-{promptId}\"), so it must stay untransformed — applying the drag transform\n // there would make the slot's own droppable rect chase the dragged item during the\n // drag, corrupting collision/keyboard-navigation results. The transform belongs on\n // the inner draggable node instead.\n if (dropId) {\n const handleResponseAreaClick = () => {\n if (disabled) return;\n\n if (isSelected) {\n // Clicking the already-selected placed answer again deselects it, same as\n // for a choice in the pool.\n onSelectClick?.(activeData);\n } else if (selectedAnswer) {\n // Something else is selected — place it here, same whether this area is\n // currently empty or already occupied.\n onPlacementClick?.(dropZoneData);\n } else if (draggable) {\n // Nothing selected yet, and this response area holds an answer — clicking it\n // selects that answer for moving elsewhere, the same way Tab+Space/Enter does.\n onSelectClick?.(activeData);\n }\n\n // Empty response area clicked with nothing selected: nothing to place or select.\n };\n\n // An empty response area isn't draggable, so dnd-kit's own attributes (only\n // applied to the inner node, and only when draggable) never make it tabbable —\n // this outer wrapper needs its own focus/activation handling so \"select a choice,\n // then Tab to a response area and press Space/Enter\" works even when the area is\n // empty. This is independent of, and doesn't change, the existing in-drag\n // Tab-cycling (that's driven by an active dnd-kit drag, not native focus).\n //\n // Only made a native Tab stop when NOT draggable (i.e. empty): when the target is\n // filled, the inner node is already independently tabbable via dnd-kit's own\n // attributes for the existing pick-up-to-move gesture, and adding a second,\n // outer Tab stop for the same visual tile would add an extra stop to the existing\n // Tab order. Placing into an occupied area is still fully reachable by mouse click\n // here, or by the existing keyboard drag flow (Tab+Space/Enter on the choice,\n // Tab-cycle to the occupied target, Space/Enter to swap).\n const isNativeTabStop = !draggable && !disabled;\n\n const handleResponseAreaKeyDown = (e) => {\n if (e.code === 'Space' || e.code === 'Enter') {\n e.preventDefault();\n handleResponseAreaClick();\n }\n };\n\n return (\n <div\n ref={setDropRef}\n role=\"button\"\n tabIndex={isNativeTabStop ? 0 : -1}\n onClick={handleResponseAreaClick}\n onKeyDown={isNativeTabStop ? handleResponseAreaKeyDown : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n flex: 1,\n opacity: isDragging || isSelected ? 0.5 : 1,\n backgroundColor: isDragging || isSelected || showsHoverEffect ? 'rgba(0,0,0,0.05)' : 'transparent',\n cursor: hasSelection && !disabled ? 'pointer' : undefined,\n }}\n >\n <div ref={setDragRef} {...listeners} {...attributes} style={{ transform: transformStyle, transition }}>\n <Answer {...props} isDragging={isDragging} isSelected={isSelected} isOver={showsHoverEffect} />\n </div>\n </div>\n );\n }\n\n const handleChoiceClick = (e) => {\n if (disabled) {\n return;\n }\n\n e.stopPropagation();\n onSelectClick?.(activeData);\n };\n\n // if there is NO dropId (this is a choice / draggable-only), render only draggable node and apply transform to it.\n return (\n <div\n ref={setDragRef}\n {...listeners}\n {...attributes}\n onClick={handleChoiceClick}\n style={{\n transform: transformStyle,\n transition,\n cursor: disabled ? 'not-allowed' : 'grab',\n opacity: isDragging || isSelected ? 0.5 : 1,\n touchAction: draggable && !disabled ? 'none' : 'auto',\n }}\n >\n <Answer {...props} isDragging={isDragging} isSelected={isSelected} isOver={false} />\n </div>\n );\n}\n\nDragAndDropAnswer.propTypes = {\n id: PropTypes.any,\n instanceId: PropTypes.string,\n promptId: PropTypes.any,\n title: PropTypes.string,\n draggable: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n selectedAnswer: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n};\n\nexport default DragAndDropAnswer;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAA2C,SAAAI,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,C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AAA8D,SAAA,CAAApI,OAAA,MAAK2D,KAAK;IAAElB,UAAU,EAAEA,UAAW;IAACC,UAAU,EAAEA,UAAW;IAACnB,MAAM,EAAE;EAAM,EAAE,CAChF,CAAC;AAEV;AAEAkE,iBAAiB,CAACtD,SAAS,GAAG;EAC5BiD,EAAE,EAAEhD,kBAAS,CAACoD,GAAG;EACjBE,UAAU,EAAEtD,kBAAS,CAACG,MAAM;EAC5BoD,QAAQ,EAAEvD,kBAAS,CAACoD,GAAG;EACvB5B,KAAK,EAAExB,kBAAS,CAACG,MAAM;EACvBqD,SAAS,EAAExD,kBAAS,CAACE,IAAI;EACzBd,QAAQ,EAAEY,kBAAS,CAACE,IAAI;EACxBb,IAAI,EAAEW,kBAAS,CAACG,MAAM;EACtBsD,cAAc,EAAEzD,kBAAS,CAACmG,MAAM;EAChCzC,aAAa,EAAE1D,kBAAS,CAACoG,IAAI;EAC7BzC,gBAAgB,EAAE3D,kBAAS,CAACoG;AAC9B,CAAC;AAAC,IAAAC,QAAA,GAAAlD,OAAA,CAAAvF,OAAA,GAEayF,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"answer.js","names":["_core","require","_propTypes","_interopRequireDefault","_react","_interopRequireWildcard","_debug","_styles","_drag","_lodashEs","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","log","debug","HolderNumber","styled","theme","width","fontSize","textAlign","color","palette","common","black","Holder","index","isOver","disabled","type","createElement","PlaceHolder","extraStyles","display","padding","alignItems","justifyContent","height","undefined","propTypes","PropTypes","number","bool","string","AnswerContentContainer","isDragging","isSelected","outcome","text","backgroundColor","white","border","correct","incorrect","cursor","boxSizing","overflow","transition","wordBreak","opacity","touchAction","AnswerContent","props","title","empty","guideIndex","dangerouslySetInnerHTML","__html","AnswerContainer","minHeight","minWidth","margin","spacing","Answer","React","Component","constructor","args","_defineProperty2","componentDidMount","ref","addEventListener","handleTouchStart","passive","componentWillUnmount","removeEventListener","render","id","className","isEmpty","exports","any","DragAndDropAnswer","instanceId","promptId","draggable","selectedAnswer","onSelectClick","onPlacementClick","dragId","dropId","activeData","value","dropZoneData","attributes","listeners","setNodeRef","setDragRef","transform","useDraggable","data","droppable","useDroppable","setDropRef","isHovered","setIsHovered","useState","hasSelection","showsHoverEffect","transformStyle","x","y","handleResponseAreaClick","isNativeTabStop","handleResponseAreaKeyDown","code","preventDefault","role","tabIndex","onClick","onKeyDown","onMouseEnter","onMouseLeave","style","flex","_extends2","handleChoiceClick","stopPropagation","object","func","_default"],"sources":["../src/answer.jsx"],"sourcesContent":["import { useDraggable, useDroppable } from '@dnd-kit/core';\nimport PropTypes from 'prop-types';\nimport React, { useState } from 'react';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { isEmpty } from 'lodash-es';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('pie-elements:match-title:answer');\n\nconst HolderNumber = styled('div')(({ theme }) => ({\n width: '100%',\n fontSize: '18px',\n textAlign: 'center',\n color: `rgba(${theme.palette.common.black}, 0.6)`,\n}));\n\nconst Holder = ({ index, isOver, disabled, type }) => (\n <PlaceHolder\n extraStyles={{\n display: 'flex',\n padding: '0',\n alignItems: 'center',\n justifyContent: 'center',\n height: '40px',\n }}\n disabled={disabled}\n isOver={isOver}\n type={type}\n >\n {index !== undefined && <HolderNumber>{index}</HolderNumber>}\n </PlaceHolder>\n);\n\nHolder.propTypes = {\n index: PropTypes.number,\n isOver: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n};\n\nconst AnswerContentContainer = styled('div')(({ isDragging, isSelected, isOver, disabled, outcome }) => ({\n color: color.text(),\n backgroundColor: color.white(),\n border: `1px solid ${\n outcome === 'correct' ? color.correct() : outcome === 'incorrect' ? color.incorrect() : color.border()\n }`,\n cursor: disabled ? 'not-allowed' : 'pointer',\n width: '100%',\n padding: '10px',\n boxSizing: 'border-box',\n overflow: 'hidden',\n transition: 'opacity 200ms linear',\n wordBreak: 'break-word',\n opacity: (isDragging || isSelected) && !disabled ? 0.5 : isOver && !disabled ? 0.2 : 1,\n touchAction: 'none',\n}));\n\nconst AnswerContent = (props) => {\n const { isDragging, isSelected, isOver, title, disabled, empty, outcome, guideIndex, type } = props;\n\n if (empty) {\n return <Holder index={guideIndex} isOver={isOver} disabled={disabled} type={type} />;\n } else {\n return (\n <AnswerContentContainer\n isDragging={isDragging}\n isSelected={isSelected}\n isOver={isOver}\n disabled={disabled}\n outcome={outcome}\n dangerouslySetInnerHTML={{ __html: title }}\n />\n );\n }\n};\n\nconst AnswerContainer = styled('div')(({ correct, theme }) => ({\n boxSizing: 'border-box',\n minHeight: 40,\n minWidth: '200px',\n overflow: 'hidden',\n margin: theme.spacing(0.5),\n padding: '0px',\n textAlign: 'center',\n height: 'initial',\n border:\n correct === true\n ? `1px solid var(--feedback-correct-bg-color, ${color.correct()})`\n : correct === false\n ? `1px solid var(--feedback-incorrect-bg-color, ${color.incorrect()})`\n : 'none',\n}));\n\nexport class Answer extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n isDragging: PropTypes.bool,\n isSelected: PropTypes.bool,\n id: PropTypes.any,\n title: PropTypes.string,\n isOver: PropTypes.bool,\n empty: PropTypes.bool,\n type: PropTypes.string,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n };\n\n componentDidMount() {\n if (this.ref) {\n // NOTE: preventing default on touchstart can block dnd-kit pointer handling on some devices.\n // Consider removing this if you have issues on touch devices.\n this.ref.addEventListener('touchstart', this.handleTouchStart, { passive: true });\n }\n }\n\n componentWillUnmount() {\n if (this.ref) {\n this.ref.removeEventListener('touchstart', this.handleTouchStart);\n }\n }\n\n handleTouchStart = (e) => {\n // do NOT call e.preventDefault() here — it prevents pointer events necessary for dnd-kit.\n // Keep this handler empty or remove it if you don't need it.\n // e.preventDefault();\n };\n\n render() {\n const {\n id,\n title,\n isDragging = false,\n isSelected = false,\n className,\n disabled,\n isOver = false,\n type,\n correct,\n } = this.props;\n\n log('[render], props: ', this.props);\n\n return (\n <AnswerContainer correct={correct} className={className} ref={(ref) => (this.ref = ref)}>\n <AnswerContent\n title={title}\n id={id}\n isOver={isOver}\n empty={isEmpty(title)}\n isDragging={isDragging}\n isSelected={isSelected}\n disabled={disabled}\n type={type}\n />\n </AnswerContainer>\n );\n }\n}\n\nfunction DragAndDropAnswer(props) {\n const {\n id,\n instanceId,\n promptId,\n draggable = true,\n disabled = false,\n type,\n selectedAnswer,\n onSelectClick,\n onPlacementClick,\n } = props;\n\n const dragId = `${type || 'answer'}-${id}`;\n // droppable only if promptId exists\n const dropId = promptId !== undefined && promptId !== null ? `drop-${promptId}` : undefined;\n\n // Built once and reused for both dnd-kit's own data and the click handlers below, so\n // a click carries exactly the same shape dnd-kit's onDragStart/onDragEnd would.\n const activeData = {\n type: type || 'answer',\n id,\n instanceId,\n value: props.title,\n promptId,\n };\n const dropZoneData = dropId\n ? {\n type: 'drop-zone',\n promptId,\n instanceId,\n }\n : undefined;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n transition,\n isDragging,\n } = useDraggable({\n id: dragId,\n data: activeData,\n disabled: !draggable || disabled,\n });\n\n const droppable = useDroppable({\n id: dropId,\n data: dropZoneData,\n disabled: disabled || !dropId,\n });\n\n const setDropRef = droppable.setNodeRef;\n const isOver = droppable.isOver;\n\n // dnd-kit's own isOver only reflects real collision detection during an active drag,\n // so it stays false while an answer is merely click-selected (no drag in progress).\n // Track hovering locally and fold it into the same isOver signal used everywhere\n // below, so hovering a response area while something is selected gets the exact same\n // treatment as hovering it during a real drag — one code path, no duplicated CSS.\n const [isHovered, setIsHovered] = useState(false);\n const hasSelection = !!selectedAnswer;\n const showsHoverEffect = isOver || (hasSelection && isHovered && !disabled);\n\n const isSelected =\n !!selectedAnswer &&\n selectedAnswer.type === activeData.type &&\n selectedAnswer.id === activeData.id &&\n selectedAnswer.promptId === activeData.promptId;\n\n // compute style: apply transform to the element that actually moves\n const transformStyle = transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined;\n\n // If this item is a drop-zone (prompt slot), we render an outer droppable wrapper.\n // The outer wrapper's rect is what dnd-kit measures for this slot's own droppable\n // (\"drop-{promptId}\"), so it must stay untransformed — applying the drag transform\n // there would make the slot's own droppable rect chase the dragged item during the\n // drag, corrupting collision/keyboard-navigation results. The transform belongs on\n // the inner draggable node instead.\n if (dropId) {\n const handleResponseAreaClick = () => {\n if (disabled) return;\n\n if (isSelected) {\n // Clicking the already-selected placed answer again deselects it, same as\n // for a choice in the pool.\n onSelectClick?.(activeData);\n } else if (selectedAnswer) {\n // Something else is selected — place it here, same whether this area is\n // currently empty or already occupied.\n onPlacementClick?.(dropZoneData);\n } else if (draggable) {\n // Nothing selected yet, and this response area holds an answer — clicking it\n // selects that answer for moving elsewhere, the same way Tab+Space/Enter does.\n onSelectClick?.(activeData);\n }\n\n // Empty response area clicked with nothing selected: nothing to place or select.\n };\n\n // An empty response area isn't draggable, so dnd-kit's own attributes (only\n // applied to the inner node, and only when draggable) never make it tabbable —\n // this outer wrapper needs its own focus/activation handling so \"select a choice,\n // then Tab to a response area and press Space/Enter\" works even when the area is\n // empty. This is independent of, and doesn't change, the existing in-drag\n // Tab-cycling (that's driven by an active dnd-kit drag, not native focus).\n //\n // Only made a native Tab stop when NOT draggable (i.e. empty): when the target is\n // filled, the inner node is already independently tabbable via dnd-kit's own\n // attributes for the existing pick-up-to-move gesture, and adding a second,\n // outer Tab stop for the same visual tile would add an extra stop to the existing\n // Tab order. Placing into an occupied area is still fully reachable by mouse click\n // here, or by the existing keyboard drag flow (Tab+Space/Enter on the choice,\n // Tab-cycle to the occupied target, Space/Enter to swap).\n const isNativeTabStop = !draggable && !disabled;\n\n const handleResponseAreaKeyDown = (e) => {\n if (e.code === 'Space' || e.code === 'Enter') {\n e.preventDefault();\n handleResponseAreaClick();\n }\n };\n\n return (\n <div\n ref={setDropRef}\n role=\"button\"\n tabIndex={isNativeTabStop ? 0 : -1}\n onClick={handleResponseAreaClick}\n onKeyDown={isNativeTabStop ? handleResponseAreaKeyDown : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n flex: 1,\n opacity: isDragging || isSelected ? 0.5 : 1,\n backgroundColor: isDragging || isSelected || showsHoverEffect ? 'rgba(0,0,0,0.05)' : 'transparent',\n cursor: hasSelection && !disabled ? 'pointer' : undefined,\n }}\n >\n <div ref={setDragRef} {...listeners} {...attributes} style={{ transform: transformStyle, transition }}>\n <Answer {...props} isDragging={isDragging} isSelected={isSelected} isOver={showsHoverEffect} />\n </div>\n </div>\n );\n }\n\n const handleChoiceClick = (e) => {\n if (disabled) {\n return;\n }\n\n e.stopPropagation();\n onSelectClick?.(activeData);\n };\n\n // if there is NO dropId (this is a choice / draggable-only), render only draggable node and apply transform to it.\n return (\n <div\n ref={setDragRef}\n {...listeners}\n {...attributes}\n onClick={handleChoiceClick}\n style={{\n transform: transformStyle,\n transition,\n cursor: disabled ? 'not-allowed' : 'grab',\n opacity: isDragging || isSelected ? 0.5 : 1,\n touchAction: draggable && !disabled ? 'none' : 'auto',\n }}\n >\n <Answer {...props} isDragging={isDragging} isSelected={isSelected} isOver={false} />\n </div>\n );\n}\n\nDragAndDropAnswer.propTypes = {\n id: PropTypes.any,\n instanceId: PropTypes.string,\n promptId: PropTypes.any,\n title: PropTypes.string,\n draggable: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n selectedAnswer: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n};\n\nexport default DragAndDropAnswer;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;A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;IACE4E,GAAG,EAAE2B;EAAW,GACZF,SAAS,EACTD,UAAU;IACdyB,OAAO,EAAEO,iBAAkB;IAC3BH,KAAK,EAAE;MACLzB,SAAS,EAAEW,cAAc;MACzB9D,UAAU;MACVH,MAAM,EAAE1B,QAAQ,GAAG,aAAa,GAAG,MAAM;MACzC+B,OAAO,EAAEd,UAAU,IAAIC,UAAU,GAAG,GAAG,GAAG,CAAC;MAC3Cc,WAAW,EAAEmC,SAAS,IAAI,CAACnE,QAAQ,GAAG,MAAM,GAAG;IACjD;EAAE,iBAEFzC,MAAA,CAAAiB,OAAA,CAAA0B,aAAA,CAAC2C,MAAM,MAAA8D,SAAA,CAAAnI,OAAA,MAAK0D,KAAK;IAAEjB,UAAU,EAAEA,UAAW;IAACC,UAAU,EAAEA,UAAW;IAACnB,MAAM,EAAE;EAAM,EAAE,CAChF,CAAC;AAEV;AAEAiE,iBAAiB,CAACrD,SAAS,GAAG;EAC5BgD,EAAE,EAAE/C,kBAAS,CAACmD,GAAG;EACjBE,UAAU,EAAErD,kBAAS,CAACG,MAAM;EAC5BmD,QAAQ,EAAEtD,kBAAS,CAACmD,GAAG;EACvB5B,KAAK,EAAEvB,kBAAS,CAACG,MAAM;EACvBoD,SAAS,EAAEvD,kBAAS,CAACE,IAAI;EACzBd,QAAQ,EAAEY,kBAAS,CAACE,IAAI;EACxBb,IAAI,EAAEW,kBAAS,CAACG,MAAM;EACtBqD,cAAc,EAAExD,kBAAS,CAACkG,MAAM;EAChCzC,aAAa,EAAEzD,kBAAS,CAACmG,IAAI;EAC7BzC,gBAAgB,EAAE1D,kBAAS,CAACmG;AAC9B,CAAC;AAAC,IAAAC,QAAA,GAAAlD,OAAA,CAAAtF,OAAA,GAEawF,iBAAiB","ignoreList":[]}
|
package/lib/arrow.js
CHANGED
|
@@ -10,16 +10,19 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
12
12
|
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
13
14
|
const ArrowContainer = (0, _styles.styled)('div')({
|
|
14
15
|
display: 'inline-block',
|
|
15
16
|
position: 'relative',
|
|
16
17
|
width: '100%'
|
|
17
18
|
});
|
|
19
|
+
|
|
20
|
+
// A 1px rule joining a prompt to its answer: it is the connector, so it needs to
|
|
21
|
+
// stay perceivable on every scheme's surface.
|
|
18
22
|
const Line = (0, _styles.styled)('span')(({
|
|
19
|
-
theme,
|
|
20
23
|
isRight
|
|
21
24
|
}) => ({
|
|
22
|
-
backgroundColor:
|
|
25
|
+
backgroundColor: _renderUi.color.border(),
|
|
23
26
|
bottom: isRight ? 20 : 19,
|
|
24
27
|
content: '""',
|
|
25
28
|
display: 'block',
|
|
@@ -41,7 +44,9 @@ class Arrow extends _react.default.Component {
|
|
|
41
44
|
}, /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, {
|
|
42
45
|
style: {
|
|
43
46
|
transform: 'rotate(90deg)',
|
|
44
|
-
|
|
47
|
+
// Pairs with Line above: head and shaft are one connector and have to
|
|
48
|
+
// step together, or the arrow loses its point on a dark scheme.
|
|
49
|
+
color: _renderUi.color.border(),
|
|
45
50
|
fontSize: 40
|
|
46
51
|
}
|
|
47
52
|
}), /*#__PURE__*/_react.default.createElement(Line, {
|
package/lib/arrow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.js","names":["_react","_interopRequireDefault","require","_propTypes","_ArrowDropDown","_styles","ArrowContainer","styled","display","position","width","Line","
|
|
1
|
+
{"version":3,"file":"arrow.js","names":["_react","_interopRequireDefault","require","_propTypes","_ArrowDropDown","_styles","_renderUi","ArrowContainer","styled","display","position","width","Line","isRight","backgroundColor","color","border","bottom","content","height","left","Arrow","React","Component","render","direction","props","extraStyle","transform","default","createElement","style","fontSize","exports","_defineProperty2","PropTypes","string","_default"],"sources":["../src/arrow.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ArrowHead from '@mui/icons-material/ArrowDropDown';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst ArrowContainer = styled('div')({\n display: 'inline-block',\n position: 'relative',\n width: '100%',\n});\n\n// A 1px rule joining a prompt to its answer: it is the connector, so it needs to\n// stay perceivable on every scheme's surface.\nconst Line = styled('span')(({ isRight }) => ({\n backgroundColor: color.border(),\n bottom: isRight ? 20 : 19,\n content: '\"\"',\n display: 'block',\n height: 1,\n left: 20,\n position: 'absolute',\n width: '100%',\n}));\n\nexport class Arrow extends React.Component {\n static propTypes = {\n direction: PropTypes.string,\n };\n\n render() {\n const { direction } = this.props;\n\n const extraStyle =\n direction === 'left'\n ? {}\n : {\n transform: 'rotate(180deg)',\n };\n\n return (\n <ArrowContainer style={extraStyle}>\n <ArrowHead\n style={{\n transform: 'rotate(90deg)',\n // Pairs with Line above: head and shaft are one connector and have to\n // step together, or the arrow loses its point on a dark scheme.\n color: color.border(),\n fontSize: 40,\n }}\n />\n <Line isRight={direction !== 'left'} />\n </ArrowContainer>\n );\n }\n}\n\nexport default Arrow;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,MAAMK,cAAc,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EACnCC,OAAO,EAAE,cAAc;EACvBC,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAE;AACT,CAAC,CAAC;;AAEF;AACA;AACA,MAAMC,IAAI,GAAG,IAAAJ,cAAM,EAAC,MAAM,CAAC,CAAC,CAAC;EAAEK;AAAQ,CAA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"
|
|
6
6
|
},
|
|
7
|
-
"version": "7.
|
|
7
|
+
"version": "7.2.0",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"@mui/icons-material": "^7.3.4",
|
|
19
19
|
"@mui/material": "^7.3.4",
|
|
20
20
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
21
|
-
"@pie-lib/correct-answer-toggle": "4.0.
|
|
22
|
-
"@pie-lib/drag": "4.1.
|
|
21
|
+
"@pie-lib/correct-answer-toggle": "4.0.6",
|
|
22
|
+
"@pie-lib/drag": "4.1.1",
|
|
23
23
|
"@pie-lib/math-rendering": "5.1.0",
|
|
24
|
-
"@pie-lib/render-ui": "
|
|
24
|
+
"@pie-lib/render-ui": "7.0.0",
|
|
25
25
|
"debug": "^4.1.1",
|
|
26
26
|
"lodash-es": "^4.17.23",
|
|
27
27
|
"prop-types": "^15.8.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "",
|
|
32
32
|
"license": "ISC",
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "e299866c75466c3c3f12469e783c129c800f24fb",
|
|
34
34
|
"main": "lib/index.js",
|
|
35
35
|
"module": "src/index.js"
|
|
36
36
|
}
|