@pie-element/multiple-choice 6.3.1 → 6.3.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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
+ ## [6.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.3.1...@pie-element/multiple-choice@6.3.2) (2022-05-16)
7
+
8
+ **Note:** Version bump only for package @pie-element/multiple-choice
9
+
10
+
11
+
12
+
13
+
6
14
  ## [6.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.3.0...@pie-element/multiple-choice@6.3.1) (2022-05-09)
7
15
 
8
16
  **Note:** Version bump only for package @pie-element/multiple-choice
@@ -3,6 +3,14 @@
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
+ ## [4.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.1...@pie-element/multiple-choice-configure@4.2.2) (2022-05-16)
7
+
8
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
9
+
10
+
11
+
12
+
13
+
6
14
  ## [4.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.0...@pie-element/multiple-choice-configure@4.2.1) (2022-05-09)
7
15
 
8
16
  **Note:** Version bump only for package @pie-element/multiple-choice-configure
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice-configure",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -8,9 +8,9 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.2.0",
11
- "@pie-lib/config-ui": "^10.12.2",
12
- "@pie-lib/editable-html": "^7.22.2",
13
- "@pie-lib/scoring-config": "^3.5.158",
11
+ "@pie-lib/config-ui": "^10.13.0",
12
+ "@pie-lib/editable-html": "^7.22.3",
13
+ "@pie-lib/scoring-config": "^3.5.160",
14
14
  "debug": "^3.1.0",
15
15
  "lodash": "^4.17.15",
16
16
  "prop-types": "^15.6.2",
@@ -19,10 +19,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
19
19
 
20
20
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
21
 
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
22
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
25
23
 
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
26
  var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
27
27
 
28
28
  var _react = _interopRequireDefault(require("react"));
@@ -49,6 +49,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
49
49
 
50
50
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
51
51
 
52
+ var CLASS_NAME = 'multiple-choice-component';
53
+
52
54
  var styleSheet = function styleSheet() {
53
55
  return {
54
56
  row: {
@@ -64,7 +66,10 @@ var styleSheet = function styleSheet() {
64
66
  '& label': {
65
67
  color: _renderUi.color.text()
66
68
  }
67
- }
69
+ },
70
+ horizontalLayout: (0, _defineProperty2["default"])({}, "& .".concat(CLASS_NAME), {
71
+ paddingRight: '8px'
72
+ })
68
73
  };
69
74
  };
70
75
 
@@ -85,7 +90,6 @@ var StyledFormControlLabel = (0, _styles.withStyles)(formStyleSheet, {
85
90
  }));
86
91
  });
87
92
  exports.StyledFormControlLabel = StyledFormControlLabel;
88
- var CLASS_NAME = 'multiple-choice-component';
89
93
 
90
94
  var colorStyle = function colorStyle(varName, fallback) {
91
95
  return (0, _defineProperty2["default"])({}, "&.".concat(CLASS_NAME), {
@@ -222,9 +226,11 @@ var ChoiceInput = /*#__PURE__*/function (_React$Component) {
222
226
  rationale = _this$props.rationale,
223
227
  accessibility = _this$props.accessibility,
224
228
  hideTick = _this$props.hideTick,
225
- isEvaluateMode = _this$props.isEvaluateMode;
229
+ isEvaluateMode = _this$props.isEvaluateMode,
230
+ choicesLayout = _this$props.choicesLayout;
226
231
  var Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;
227
232
  var classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';
233
+ var holderClassNames = (0, _classnames["default"])(classes.checkboxHolder, (0, _defineProperty2["default"])({}, classes.horizontalLayout, choicesLayout === 'horizontal'));
228
234
  return /*#__PURE__*/_react["default"].createElement("div", {
229
235
  className: (0, _classnames["default"])(className, 'corespring-' + classSuffix, 'choice-input')
230
236
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -232,7 +238,7 @@ var ChoiceInput = /*#__PURE__*/function (_React$Component) {
232
238
  }, !hideTick && isEvaluateMode && /*#__PURE__*/_react["default"].createElement(_feedbackTick["default"], {
233
239
  correctness: correctness
234
240
  }), /*#__PURE__*/_react["default"].createElement("div", {
235
- className: (0, _classnames["default"])(classes.checkboxHolder, 'checkbox-holder')
241
+ className: (0, _classnames["default"])(holderClassNames, 'checkbox-holder')
236
242
  }, /*#__PURE__*/_react["default"].createElement(StyledFormControlLabel, {
237
243
  disabled: disabled,
238
244
  label: displayKey ? displayKey + '. ' : '',
@@ -276,7 +282,8 @@ exports.ChoiceInput = ChoiceInput;
276
282
  classes: _propTypes["default"].object,
277
283
  className: _propTypes["default"].string,
278
284
  hideTick: _propTypes["default"].bool,
279
- isEvaluateMode: _propTypes["default"].bool
285
+ isEvaluateMode: _propTypes["default"].bool,
286
+ choicesLayout: _propTypes["default"].oneOf(['vertical', 'grid', 'horizontal'])
280
287
  });
281
288
  (0, _defineProperty2["default"])(ChoiceInput, "defaultProps", {
282
289
  rationale: null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/choice-input.jsx"],"names":["styleSheet","row","display","alignItems","backgroundColor","color","background","checkboxHolder","flex","text","formStyleSheet","label","StyledFormControlLabel","name","props","classes","CLASS_NAME","colorStyle","varName","fallback","inputStyles","correct","disabled","incorrect","root","primaryLight","checked","primary","opacity","cursor","pointerEvents","StyledCheckbox","correctness","onChange","accessibility","key","k","resolved","miniProps","StyledRadio","ChoiceInput","onToggleChoice","bind","value","selected","choiceMode","displayKey","feedback","className","rationale","hideTick","isEvaluateMode","Tag","classSuffix","React","Component","PropTypes","oneOf","string","isRequired","bool","func","object"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,SAAbA,UAAa;AAAA,SAAO;AACxBC,IAAAA,GAAG,EAAE;AACHC,MAAAA,OAAO,EAAE,MADN;AAEHC,MAAAA,UAAU,EAAE,QAFT;AAGHC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN;AAHd,KADmB;AAMxBC,IAAAA,cAAc,EAAE;AACdL,MAAAA,OAAO,EAAE,MADK;AAEdC,MAAAA,UAAU,EAAE,QAFE;AAGdC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAHH;AAIdE,MAAAA,IAAI,EAAE,CAJQ;AAKd,iBAAW;AACTH,QAAAA,KAAK,EAAEA,gBAAMI,IAAN;AADE;AALG;AANQ,GAAP;AAAA,CAAnB;;AAiBA,IAAMC,cAAc,GAAG;AACrBC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IjB3B,EAAAA,WAAW,EAAEwB,sBAAUE,MAJN;AAKjBpC,EAAAA,QAAQ,EAAEkC,sBAAUI,IAAV,CAAeD,UALR;AAMjBZ,EAAAA,QAAQ,EAAES,sBAAUE,MANH;AAOjB/C,EAAAA,KAAK,EAAE6C,sBAAUE,MAAV,CAAiBC,UAPP;AAQjBV,EAAAA,SAAS,EAAEO,sBAAUE,MARJ;AASjBxB,EAAAA,aAAa,EAAEsB,sBAAUE,MATR;AAUjBzB,EAAAA,QAAQ,EAAEuB,sBAAUK,IAAV,CAAeF,UAVR;AAWjBhB,EAAAA,KAAK,EAAEa,sBAAUE,MAAV,CAAiBC,UAXP;AAYjB5C,EAAAA,OAAO,EAAEyC,sBAAUM,MAZF;AAajBd,EAAAA,SAAS,EAAEQ,sBAAUE,MAbJ;AAcjBR,EAAAA,QAAQ,EAAEM,sBAAUI,IAdH;AAejBT,EAAAA,cAAc,EAAEK,sBAAUI;AAfT,C;iCADRpB,W,kBAmBW;AACpBS,EAAAA,SAAS,EAAE,IADS;AAEpBf,EAAAA,aAAa,EAAE,IAFK;AAGpBR,EAAAA,OAAO,EAAE,KAHW;AAIpByB,EAAAA,cAAc,EAAE;AAJI,C;;eAyET,wBAAWnD,UAAX,EAAuBwC,WAAvB,C","sourcesContent":["import FormControlLabel from '@material-ui/core/FormControlLabel';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport Checkbox from '@material-ui/core/Checkbox';\nimport { Feedback, color, PreviewPrompt } from '@pie-lib/render-ui';\nimport FeedbackTick from './feedback-tick';\nimport Radio from '@material-ui/core/Radio';\nimport classNames from 'classnames';\n\nconst styleSheet = () => ({\n row: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n },\n checkboxHolder: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n flex: 1,\n '& label': {\n color: color.text(),\n },\n },\n});\n\nconst formStyleSheet = {\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)'\n backgroundColor: color.background(),\n },\n};\n\nexport const StyledFormControlLabel = withStyles(formStyleSheet, {\n name: 'FormControlLabel',\n})((props) => (\n <FormControlLabel {...props} classes={{ label: props.classes.label }} />\n));\n\nconst CLASS_NAME = 'multiple-choice-component';\n\nconst colorStyle = (varName, fallback) => ({\n [`&.${CLASS_NAME}`]: {\n color: `var(--choice-input-${varName}, ${fallback}) !important`,\n },\n});\n\nconst inputStyles = {\n 'correct-root': colorStyle('correct-color', color.text()),\n 'correct-checked': colorStyle('correct-selected-color', color.correct()), //green[500]),\n 'correct-disabled': colorStyle('correct-disabled-color', color.disabled()), //'grey'),\n 'incorrect-root': colorStyle('incorrect-color', color.incorrect()),\n 'incorrect-checked': colorStyle('incorrect-checked', color.incorrect()), //orange[500]),\n 'incorrect-disabled': colorStyle(\n 'incorrect-disabled-color',\n color.disabled()\n ),\n root: {\n ...colorStyle('color', color.text()),\n '&:hover': { color: `${color.primaryLight()} !important` },\n },\n checked: colorStyle('selected-color', color.primary()),\n disabled: {\n ...colorStyle('disabled-color', color.text()),\n opacity: 0.6,\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n },\n};\n\nexport const StyledCheckbox = withStyles(inputStyles)((props) => {\n const {\n correctness,\n classes,\n checked,\n onChange,\n disabled,\n accessibility,\n } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n return (\n <Checkbox\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: `${correctness ? '' : resolved.disabled}`,\n }}\n />\n );\n});\n\nexport const StyledRadio = withStyles(inputStyles)((props) => {\n const {\n correctness,\n classes,\n checked,\n onChange,\n disabled,\n accessibility,\n } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n\n return (\n <Radio\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: `${correctness ? '' : resolved.disabled}`,\n }}\n />\n );\n});\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n displayKey: PropTypes.string.isRequired,\n checked: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n feedback: PropTypes.string,\n label: PropTypes.string.isRequired,\n rationale: PropTypes.string,\n accessibility: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired,\n classes: PropTypes.object,\n className: PropTypes.string,\n hideTick: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n };\n\n static defaultProps = {\n rationale: null,\n accessibility: null,\n checked: false,\n isEvaluateMode: false,\n };\n\n constructor(props) {\n super(props);\n this.onToggleChoice = this.onToggleChoice.bind(this);\n }\n\n onToggleChoice() {\n this.props.onChange({\n value: this.props.value,\n selected: !this.props.checked,\n });\n }\n\n render() {\n const {\n choiceMode,\n disabled,\n displayKey,\n feedback,\n label,\n checked,\n correctness,\n classes,\n className,\n rationale,\n accessibility,\n hideTick,\n isEvaluateMode,\n } = this.props;\n\n const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;\n const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';\n\n return (\n <div className={classNames(className, 'corespring-' + classSuffix, 'choice-input')}>\n <div className={classes.row}>\n {(!hideTick && isEvaluateMode) && <FeedbackTick correctness={correctness} />}\n <div className={classNames(classes.checkboxHolder, 'checkbox-holder')}>\n <StyledFormControlLabel\n disabled={disabled}\n label={displayKey ? displayKey + '. ' : ''}\n control={\n <Tag\n accessibility={accessibility}\n checked={checked}\n correctness={correctness}\n onChange={this.onToggleChoice}\n />\n }\n />\n <PreviewPrompt\n className=\"label\"\n onClick={this.onToggleChoice}\n prompt={label}\n tagName=\"span\"\n />\n </div>\n </div>\n {rationale && (\n <PreviewPrompt className=\"rationale\" defaultClassName=\"rationale\" prompt={rationale} />\n )}\n <Feedback feedback={feedback} correctness={correctness} />\n </div>\n );\n }\n}\n\nexport default withStyles(styleSheet)(ChoiceInput);\n"],"file":"choice-input.js"}
1
+ {"version":3,"sources":["../src/choice-input.jsx"],"names":["CLASS_NAME","styleSheet","row","display","alignItems","backgroundColor","color","background","checkboxHolder","flex","text","horizontalLayout","paddingRight","formStyleSheet","label","StyledFormControlLabel","name","props","classes","colorStyle","varName","fallback","inputStyles","correct","disabled","incorrect","root","primaryLight","checked","primary","opacity","cursor","pointerEvents","StyledCheckbox","correctness","onChange","accessibility","key","k","resolved","miniProps","StyledRadio","ChoiceInput","onToggleChoice","bind","value","selected","choiceMode","displayKey","feedback","className","rationale","hideTick","isEvaluateMode","choicesLayout","Tag","classSuffix","holderClassNames","React","Component","PropTypes","oneOf","string","isRequired","bool","func","object"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,2BAAnB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa;AAAA,SAAO;AACxBC,IAAAA,GAAG,EAAE;AACHC,MAAAA,OAAO,EAAE,MADN;AAEHC,MAAAA,UAAU,EAAE,QAFT;AAGHC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN;AAHd,KADmB;AAMxBC,IAAAA,cAAc,EAAE;AACdL,MAAAA,OAAO,EAAE,MADK;AAEdC,MAAAA,UAAU,EAAE,QAFE;AAGdC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAHH;AAIdE,MAAAA,IAAI,EAAE,CAJQ;AAKd,iBAAW;AACTH,QAAAA,KAAK,EAAEA,gBAAMI,IAAN;AADE;AAL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BAAMC,S;;;iCAA1BjB,W,eACQ;AACjBK,EAAAA,UAAU,EAAEa,sBAAUC,KAAV,CAAgB,CAAC,OAAD,EAAU,UAAV,CAAhB,CADK;AAEjBb,EAAAA,UAAU,EAAEY,sBAAUE,MAAV,CAAiBC,UAFZ;AAGjBnC,EAAAA,OAAO,EAAEgC,sBAAUI,IAAV,CAAeD,UAHP;AAIjB7B,EAAAA,WAAW,EAAE0B,sBAAUE,MAJN;AAKjBtC,EAAAA,QAAQ,EAAEoC,sBAAUI,IAAV,CAAeD,UALR;AAMjBd,EAAAA,QAAQ,EAAEW,sBAAUE,MANH;AAOjBhD,EAAAA,KAAK,EAAE8C,sBAAUE,MAAV,CAAiBC,UAPP;AAQjBZ,EAAAA,SAAS,EAAES,sBAAUE,MARJ;AASjB1B,EAAAA,aAAa,EAAEwB,sBAAUE,MATR;AAUjB3B,EAAAA,QAAQ,EAAEyB,sBAAUK,IAAV,CAAeF,UAVR;AAWjBlB,EAAAA,KAAK,EAAEe,sBAAUE,MAAV,CAAiBC,UAXP;AAYjB7C,EAAAA,OAAO,EAAE0C,sBAAUM,MAZF;AAajBhB,EAAAA,SAAS,EAAEU,sBAAUE,MAbJ;AAcjBV,EAAAA,QAAQ,EAAEQ,sBAAUI,IAdH;AAejBX,EAAAA,cAAc,EAAEO,sBAAUI,IAfT;AAgBjBV,EAAAA,aAAa,EAAEM,sBAAUC,KAAV,CAAgB,CAAC,UAAD,EAAa,MAAb,EAAqB,YAArB,CAAhB;AAhBE,C;iCADRnB,W,kBAoBW;AACpBS,EAAAA,SAAS,EAAE,IADS;AAEpBf,EAAAA,aAAa,EAAE,IAFK;AAGpBR,EAAAA,OAAO,EAAE,KAHW;AAIpByB,EAAAA,cAAc,EAAE;AAJI,C;;eA8ET,wBAAWpD,UAAX,EAAuByC,WAAvB,C","sourcesContent":["import FormControlLabel from '@material-ui/core/FormControlLabel';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport Checkbox from '@material-ui/core/Checkbox';\nimport { Feedback, color, PreviewPrompt } from '@pie-lib/render-ui';\nimport FeedbackTick from './feedback-tick';\nimport Radio from '@material-ui/core/Radio';\nimport classNames from 'classnames';\n\nconst CLASS_NAME = 'multiple-choice-component';\n\nconst styleSheet = () => ({\n row: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n },\n checkboxHolder: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n flex: 1,\n '& label': {\n color: color.text(),\n },\n },\n horizontalLayout: {\n [`& .${CLASS_NAME}`]: {\n paddingRight: '8px',\n }\n }\n});\n\nconst formStyleSheet = {\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)'\n backgroundColor: color.background(),\n },\n};\n\nexport const StyledFormControlLabel = withStyles(formStyleSheet, {\n name: 'FormControlLabel',\n})((props) => (\n <FormControlLabel {...props} classes={{ label: props.classes.label }} />\n));\n\nconst colorStyle = (varName, fallback) => ({\n [`&.${CLASS_NAME}`]: {\n color: `var(--choice-input-${varName}, ${fallback}) !important`,\n },\n});\n\nconst inputStyles = {\n 'correct-root': colorStyle('correct-color', color.text()),\n 'correct-checked': colorStyle('correct-selected-color', color.correct()), //green[500]),\n 'correct-disabled': colorStyle('correct-disabled-color', color.disabled()), //'grey'),\n 'incorrect-root': colorStyle('incorrect-color', color.incorrect()),\n 'incorrect-checked': colorStyle('incorrect-checked', color.incorrect()), //orange[500]),\n 'incorrect-disabled': colorStyle(\n 'incorrect-disabled-color',\n color.disabled()\n ),\n root: {\n ...colorStyle('color', color.text()),\n '&:hover': { color: `${color.primaryLight()} !important` },\n },\n checked: colorStyle('selected-color', color.primary()),\n disabled: {\n ...colorStyle('disabled-color', color.text()),\n opacity: 0.6,\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n },\n};\n\nexport const StyledCheckbox = withStyles(inputStyles)((props) => {\n const {\n correctness,\n classes,\n checked,\n onChange,\n disabled,\n accessibility,\n } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n return (\n <Checkbox\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: `${correctness ? '' : resolved.disabled}`,\n }}\n />\n );\n});\n\nexport const StyledRadio = withStyles(inputStyles)((props) => {\n const {\n correctness,\n classes,\n checked,\n onChange,\n disabled,\n accessibility,\n } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n\n return (\n <Radio\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: `${correctness ? '' : resolved.disabled}`,\n }}\n />\n );\n});\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n displayKey: PropTypes.string.isRequired,\n checked: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n feedback: PropTypes.string,\n label: PropTypes.string.isRequired,\n rationale: PropTypes.string,\n accessibility: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired,\n classes: PropTypes.object,\n className: PropTypes.string,\n hideTick: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n };\n\n static defaultProps = {\n rationale: null,\n accessibility: null,\n checked: false,\n isEvaluateMode: false,\n };\n\n constructor(props) {\n super(props);\n this.onToggleChoice = this.onToggleChoice.bind(this);\n }\n\n onToggleChoice() {\n this.props.onChange({\n value: this.props.value,\n selected: !this.props.checked,\n });\n }\n\n render() {\n const {\n choiceMode,\n disabled,\n displayKey,\n feedback,\n label,\n checked,\n correctness,\n classes,\n className,\n rationale,\n accessibility,\n hideTick,\n isEvaluateMode,\n choicesLayout\n } = this.props;\n\n const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;\n const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';\n\n const holderClassNames = classNames(classes.checkboxHolder, {\n [classes.horizontalLayout]: choicesLayout === 'horizontal',\n });\n\n return (\n <div className={classNames(className, 'corespring-' + classSuffix, 'choice-input')}>\n <div className={classes.row}>\n {(!hideTick && isEvaluateMode) && <FeedbackTick correctness={correctness} />}\n <div className={classNames(holderClassNames, 'checkbox-holder')}>\n <StyledFormControlLabel\n disabled={disabled}\n label={displayKey ? displayKey + '. ' : ''}\n control={\n <Tag\n accessibility={accessibility}\n checked={checked}\n correctness={correctness}\n onChange={this.onToggleChoice}\n />\n }\n />\n <PreviewPrompt\n className=\"label\"\n onClick={this.onToggleChoice}\n prompt={label}\n tagName=\"span\"\n />\n </div>\n </div>\n {rationale && (\n <PreviewPrompt className=\"rationale\" defaultClassName=\"rationale\" prompt={rationale} />\n )}\n <Feedback feedback={feedback} correctness={correctness} />\n </div>\n );\n }\n}\n\nexport default withStyles(styleSheet)(ChoiceInput);\n"],"file":"choice-input.js"}
package/lib/choice.js CHANGED
@@ -71,6 +71,8 @@ var Choice = /*#__PURE__*/function (_React$Component) {
71
71
  (0, _createClass2["default"])(Choice, [{
72
72
  key: "render",
73
73
  value: function render() {
74
+ var _classNames;
75
+
74
76
  var _this$props2 = this.props,
75
77
  choice = _this$props2.choice,
76
78
  index = _this$props2.index,
@@ -101,7 +103,7 @@ var Choice = /*#__PURE__*/function (_React$Component) {
101
103
  isEvaluateMode: isEvaluateMode
102
104
  });
103
105
 
104
- var names = (0, _classnames["default"])(classes.choice, (0, _defineProperty2["default"])({}, classes.noBorder, index === choicesLength - 1 || choicesLayout !== 'vertical'));
106
+ var names = (0, _classnames["default"])(classes.choice, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.noBorder, index === choicesLength - 1 || choicesLayout !== 'vertical'), (0, _defineProperty2["default"])(_classNames, classes.horizontalLayout, choicesLayout === 'horizontal'), _classNames));
105
107
  return /*#__PURE__*/_react["default"].createElement("div", {
106
108
  className: choiceClass,
107
109
  key: index
@@ -139,6 +141,15 @@ var _default = (0, _styles.withStyles)({
139
141
  },
140
142
  noBorder: {
141
143
  borderBottom: 'none'
144
+ },
145
+ horizontalLayout: {
146
+ paddingRight: '20px',
147
+ '& label': {
148
+ marginRight: '8px' // '& span:first-child': {
149
+ // paddingRight: 0
150
+ // }
151
+
152
+ }
142
153
  }
143
154
  })(Choice);
144
155
 
package/lib/choice.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/choice.jsx"],"names":["Choice","choice","props","disabled","onChoiceChanged","index","choicesLength","showCorrect","isEvaluateMode","choiceMode","checked","correctness","displayKey","classes","choicesLayout","gridColumns","choiceClass","feedback","choiceProps","onChange","names","noBorder","React","Component","propTypes","PropTypes","oneOf","object","bool","isRequired","func","number","string","paddingTop","paddingBottom","borderBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,M;;;;;;;;;;;;;;;iGACA,UAACC,MAAD,EAAY;AACrB,wBAAsC,MAAKC,KAA3C;AAAA,UAAQC,QAAR,eAAQA,QAAR;AAAA,UAAkBC,eAAlB,eAAkBA,eAAlB;;AAEA,UAAI,CAACD,QAAL,EAAe;AACbC,QAAAA,eAAe,CAACH,MAAD,CAAf;AACD;AACF,K;;;;;;WAED,kBAAS;AACP,yBAcI,KAAKC,KAdT;AAAA,UACED,MADF,gBACEA,MADF;AAAA,UAEEI,KAFF,gBAEEA,KAFF;AAAA,UAGEC,aAHF,gBAGEA,aAHF;AAAA,UAIEC,WAJF,gBAIEA,WAJF;AAAA,UAKEC,cALF,gBAKEA,cALF;AAAA,UAMEC,UANF,gBAMEA,UANF;AAAA,UAOEN,Q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D,EAAU,UAAV,CAAhB,CADK;AAEjBzB,EAAAA,MAAM,EAAEwB,sBAAUE,MAFD;AAGjBxB,EAAAA,QAAQ,EAAEsB,sBAAUG,IAAV,CAAeC,UAHR;AAIjBzB,EAAAA,eAAe,EAAEqB,sBAAUK,IAJV;AAKjBjB,EAAAA,OAAO,EAAEY,sBAAUE,MAAV,CAAiBE,UALT;AAMjBxB,EAAAA,KAAK,EAAEoB,sBAAUM,MANA;AAOjBzB,EAAAA,aAAa,EAAEmB,sBAAUM,MAPR;AAQjBxB,EAAAA,WAAW,EAAEkB,sBAAUG,IARN;AASjBpB,EAAAA,cAAc,EAAEiB,sBAAUG,IATT;AAUjBlB,EAAAA,OAAO,EAAEe,sBAAUG,IAVF;AAWjBjB,EAAAA,WAAW,EAAEc,sBAAUO,MAXN;AAYjBpB,EAAAA,UAAU,EAAEa,sBAAUO,MAZL;AAajBlB,EAAAA,aAAa,EAAEW,sBAAUC,KAAV,CAAgB,CAAC,UAAD,EAAa,MAAb,EAAqB,YAArB,CAAhB,CAbE;AAcjBX,EAAAA,WAAW,EAAEU,sBAAUO;AAdN,CAAnB;;eAiBe,wBAAW;AACxB/B,EAAAA,MAAM,EAAE;AACNgC,IAAAA,UAAU,EAAE,MADN;AAENC,IAAAA,aAAa,EAAE,MAFT;AAGNC,IAAAA,YAAY,EAAE;AAHR,GADgB;AAMxBd,EAAAA,QAAQ,EAAE;AACRc,IAAAA,YAAY,EAAE;AADN;AANc,CAAX,EASZnC,MATY,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport ChoiceInput from './choice-input';\n\nexport class Choice extends React.Component {\n onChange = (choice) => {\n const { disabled, onChoiceChanged } = this.props;\n\n if (!disabled) {\n onChoiceChanged(choice);\n }\n };\n\n render() {\n const {\n choice,\n index,\n choicesLength,\n showCorrect,\n isEvaluateMode,\n choiceMode,\n disabled,\n checked,\n correctness,\n displayKey,\n classes,\n choicesLayout,\n gridColumns,\n } = this.props;\n const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');\n\n const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;\n\n const choiceProps = {\n ...choice,\n checked,\n choiceMode,\n disabled,\n feedback,\n correctness,\n displayKey,\n choicesLayout,\n gridColumns,\n onChange: this.onChange,\n isEvaluateMode,\n };\n\n const names = classNames(classes.choice, {\n [classes.noBorder]:\n index === choicesLength - 1 || choicesLayout !== 'vertical',\n });\n\n return (\n <div className={choiceClass} key={index}>\n <ChoiceInput {...choiceProps} className={names} />\n </div>\n );\n }\n}\n\nChoice.propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n choice: PropTypes.object,\n disabled: PropTypes.bool.isRequired,\n onChoiceChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n index: PropTypes.number,\n choicesLength: PropTypes.number,\n showCorrect: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n checked: PropTypes.bool,\n correctness: PropTypes.string,\n displayKey: PropTypes.string,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n};\n\nexport default withStyles({\n choice: {\n paddingTop: '20px',\n paddingBottom: '10px',\n borderBottom: '1px solid #E0DEE0',\n },\n noBorder: {\n borderBottom: 'none',\n },\n})(Choice);\n"],"file":"choice.js"}
1
+ {"version":3,"sources":["../src/choice.jsx"],"names":["Choice","choice","props","disabled","onChoiceChanged","index","choicesLength","showCorrect","isEvaluateMode","choiceMode","checked","correctness","displayKey","classes","choicesLayout","gridColumns","choiceClass","feedback","choiceProps","onChange","names","noBorder","horizontalLayout","React","Component","propTypes","PropTypes","oneOf","object","bool","isRequired","func","number","string","paddingTop","paddingBottom","borderBottom","paddingRight","marginRight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,M;;;;;;;;;;;;;;;iGACA,UAACC,MAAD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A,MAAM,EAAE;AACNiC,IAAAA,UAAU,EAAE,MADN;AAENC,IAAAA,aAAa,EAAE,MAFT;AAGNC,IAAAA,YAAY,EAAE;AAHR,GADgB;AAMxBf,EAAAA,QAAQ,EAAE;AACRe,IAAAA,YAAY,EAAE;AADN,GANc;AASxBd,EAAAA,gBAAgB,EAAE;AAChBe,IAAAA,YAAY,EAAE,MADE;AAEhB,eAAW;AACTC,MAAAA,WAAW,EAAE,KADJ,CAET;AACA;AACA;;AAJS;AAFK;AATM,CAAX,EAkBZtC,MAlBY,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport ChoiceInput from './choice-input';\n\nexport class Choice extends React.Component {\n onChange = (choice) => {\n const { disabled, onChoiceChanged } = this.props;\n\n if (!disabled) {\n onChoiceChanged(choice);\n }\n };\n\n render() {\n const {\n choice,\n index,\n choicesLength,\n showCorrect,\n isEvaluateMode,\n choiceMode,\n disabled,\n checked,\n correctness,\n displayKey,\n classes,\n choicesLayout,\n gridColumns,\n } = this.props;\n const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');\n\n const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;\n\n const choiceProps = {\n ...choice,\n checked,\n choiceMode,\n disabled,\n feedback,\n correctness,\n displayKey,\n choicesLayout,\n gridColumns,\n onChange: this.onChange,\n isEvaluateMode,\n };\n\n const names = classNames(classes.choice, {\n [classes.noBorder]:\n index === choicesLength - 1 || choicesLayout !== 'vertical',\n [classes.horizontalLayout]: choicesLayout === 'horizontal',\n });\n\n return (\n <div className={choiceClass} key={index}>\n <ChoiceInput {...choiceProps} className={names} />\n </div>\n );\n }\n}\n\nChoice.propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n choice: PropTypes.object,\n disabled: PropTypes.bool.isRequired,\n onChoiceChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n index: PropTypes.number,\n choicesLength: PropTypes.number,\n showCorrect: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n checked: PropTypes.bool,\n correctness: PropTypes.string,\n displayKey: PropTypes.string,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n};\n\nexport default withStyles({\n choice: {\n paddingTop: '20px',\n paddingBottom: '10px',\n borderBottom: '1px solid #E0DEE0',\n },\n noBorder: {\n borderBottom: 'none',\n },\n horizontalLayout: {\n paddingRight: '20px',\n '& label': {\n marginRight: '8px',\n // '& span:first-child': {\n // paddingRight: 0\n // }\n },\n }\n})(Choice);\n"],"file":"choice.js"}
@@ -1,6 +1,6 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_material_ui__icons, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.15/module/index.js";
2
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.2.2/module/index.js";
3
- import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.2/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_material_ui__icons, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.17/module/index.js";
2
+ import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.2.4/module/index.js";
3
+ import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.4/module/index.js";
4
4
  var lib = {};
5
5
  Object.defineProperty(lib, "__esModule", {
6
6
  value: true
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.15/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.3/module/index.js";
1
+ import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.17/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.5/module/index.js";
3
3
  function getDefaultExportFromCjs(x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
5
  }
@@ -1259,6 +1259,7 @@ const {color: color$1} = _dll_pie_lib__render_ui;
1259
1259
  const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__render_ui;
1260
1260
  const classNames$3 = _dll_classnames;
1261
1261
  const _jsxFileName$3 = "/home/circleci/repo/packages/multiple-choice/src/choice-input.jsx";
1262
+ const CLASS_NAME = 'multiple-choice-component';
1262
1263
  const styleSheet = () => ({
1263
1264
  row: {
1264
1265
  display: 'flex',
@@ -1273,6 +1274,11 @@ const styleSheet = () => ({
1273
1274
  '& label': {
1274
1275
  color: color$1.text()
1275
1276
  }
1277
+ },
1278
+ horizontalLayout: {
1279
+ [`& .${CLASS_NAME}`]: {
1280
+ paddingRight: '8px'
1281
+ }
1276
1282
  }
1277
1283
  });
1278
1284
  const formStyleSheet = {
@@ -1291,10 +1297,9 @@ const StyledFormControlLabel = withStyles$3(formStyleSheet, {
1291
1297
  __self: undefined,
1292
1298
  __source: {
1293
1299
  fileName: _jsxFileName$3,
1294
- lineNumber: 39
1300
+ lineNumber: 46
1295
1301
  }
1296
1302
  }));
1297
- const CLASS_NAME = 'multiple-choice-component';
1298
1303
  const colorStyle = (varName, fallback) => ({
1299
1304
  [`&.${CLASS_NAME}`]: {
1300
1305
  color: `var(--choice-input-${varName}, ${fallback}) !important`
@@ -1346,7 +1351,7 @@ const StyledCheckbox = withStyles$3(inputStyles)(props => {
1346
1351
  __self: undefined,
1347
1352
  __source: {
1348
1353
  fileName: _jsxFileName$3,
1349
- lineNumber: 92
1354
+ lineNumber: 97
1350
1355
  }
1351
1356
  });
1352
1357
  });
@@ -1375,7 +1380,7 @@ const StyledRadio = withStyles$3(inputStyles)(props => {
1375
1380
  __self: undefined,
1376
1381
  __source: {
1377
1382
  fileName: _jsxFileName$3,
1378
- lineNumber: 125
1383
+ lineNumber: 130
1379
1384
  }
1380
1385
  });
1381
1386
  });
@@ -1396,7 +1401,8 @@ class ChoiceInput extends React$4.Component {
1396
1401
  classes: PropTypes$3.object,
1397
1402
  className: PropTypes$3.string,
1398
1403
  hideTick: PropTypes$3.bool,
1399
- isEvaluateMode: PropTypes$3.bool
1404
+ isEvaluateMode: PropTypes$3.bool,
1405
+ choicesLayout: PropTypes$3.oneOf(['vertical', 'grid', 'horizontal'])
1400
1406
  };
1401
1407
  }
1402
1408
  static __initStatic2() {
@@ -1418,36 +1424,39 @@ class ChoiceInput extends React$4.Component {
1418
1424
  });
1419
1425
  }
1420
1426
  render() {
1421
- const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode} = this.props;
1427
+ const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode, choicesLayout} = this.props;
1422
1428
  const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;
1423
1429
  const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';
1430
+ const holderClassNames = classNames$3(classes.checkboxHolder, {
1431
+ [classes.horizontalLayout]: choicesLayout === 'horizontal'
1432
+ });
1424
1433
  return React$4.createElement('div', {
1425
1434
  className: classNames$3(className, 'corespring-' + classSuffix, 'choice-input'),
1426
1435
  __self: this,
1427
1436
  __source: {
1428
1437
  fileName: _jsxFileName$3,
1429
- lineNumber: 197
1438
+ lineNumber: 208
1430
1439
  }
1431
1440
  }, React$4.createElement('div', {
1432
1441
  className: classes.row,
1433
1442
  __self: this,
1434
1443
  __source: {
1435
1444
  fileName: _jsxFileName$3,
1436
- lineNumber: 198
1445
+ lineNumber: 209
1437
1446
  }
1438
1447
  }, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
1439
1448
  correctness: correctness,
1440
1449
  __self: this,
1441
1450
  __source: {
1442
1451
  fileName: _jsxFileName$3,
1443
- lineNumber: 199
1452
+ lineNumber: 210
1444
1453
  }
1445
1454
  }), React$4.createElement('div', {
1446
- className: classNames$3(classes.checkboxHolder, 'checkbox-holder'),
1455
+ className: classNames$3(holderClassNames, 'checkbox-holder'),
1447
1456
  __self: this,
1448
1457
  __source: {
1449
1458
  fileName: _jsxFileName$3,
1450
- lineNumber: 200
1459
+ lineNumber: 211
1451
1460
  }
1452
1461
  }, React$4.createElement(StyledFormControlLabel, {
1453
1462
  disabled: disabled,
@@ -1460,13 +1469,13 @@ class ChoiceInput extends React$4.Component {
1460
1469
  __self: this,
1461
1470
  __source: {
1462
1471
  fileName: _jsxFileName$3,
1463
- lineNumber: 205
1472
+ lineNumber: 216
1464
1473
  }
1465
1474
  }),
1466
1475
  __self: this,
1467
1476
  __source: {
1468
1477
  fileName: _jsxFileName$3,
1469
- lineNumber: 201
1478
+ lineNumber: 212
1470
1479
  }
1471
1480
  }), React$4.createElement(PreviewPrompt$1, {
1472
1481
  className: "label",
@@ -1476,7 +1485,7 @@ class ChoiceInput extends React$4.Component {
1476
1485
  __self: this,
1477
1486
  __source: {
1478
1487
  fileName: _jsxFileName$3,
1479
- lineNumber: 213
1488
+ lineNumber: 224
1480
1489
  }
1481
1490
  }))), rationale && React$4.createElement(PreviewPrompt$1, {
1482
1491
  className: "rationale",
@@ -1485,7 +1494,7 @@ class ChoiceInput extends React$4.Component {
1485
1494
  __self: this,
1486
1495
  __source: {
1487
1496
  fileName: _jsxFileName$3,
1488
- lineNumber: 222
1497
+ lineNumber: 233
1489
1498
  }
1490
1499
  }), React$4.createElement(Feedback, {
1491
1500
  feedback: feedback,
@@ -1493,7 +1502,7 @@ class ChoiceInput extends React$4.Component {
1493
1502
  __self: this,
1494
1503
  __source: {
1495
1504
  fileName: _jsxFileName$3,
1496
- lineNumber: 224
1505
+ lineNumber: 235
1497
1506
  }
1498
1507
  }));
1499
1508
  }
@@ -1537,7 +1546,8 @@ class Choice extends React$3.Component {
1537
1546
  isEvaluateMode
1538
1547
  };
1539
1548
  const names = classNames$2(classes.choice, {
1540
- [classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical'
1549
+ [classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
1550
+ [classes.horizontalLayout]: choicesLayout === 'horizontal'
1541
1551
  });
1542
1552
  return React$3.createElement('div', {
1543
1553
  className: choiceClass,
@@ -1545,7 +1555,7 @@ class Choice extends React$3.Component {
1545
1555
  __self: this,
1546
1556
  __source: {
1547
1557
  fileName: _jsxFileName$2,
1548
- lineNumber: 56
1558
+ lineNumber: 57
1549
1559
  }
1550
1560
  }, React$3.createElement(ChoiceInput$1, {
1551
1561
  ...choiceProps,
@@ -1553,7 +1563,7 @@ class Choice extends React$3.Component {
1553
1563
  __self: this,
1554
1564
  __source: {
1555
1565
  fileName: _jsxFileName$2,
1556
- lineNumber: 57
1566
+ lineNumber: 58
1557
1567
  }
1558
1568
  }));
1559
1569
  }
@@ -1582,6 +1592,12 @@ var StyledChoice = withStyles$2({
1582
1592
  },
1583
1593
  noBorder: {
1584
1594
  borderBottom: 'none'
1595
+ },
1596
+ horizontalLayout: {
1597
+ paddingRight: '20px',
1598
+ '& label': {
1599
+ marginRight: '8px'
1600
+ }
1585
1601
  }
1586
1602
  })(Choice);
1587
1603
  const React$2 = _dll_react;
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/multiple-choice@6.3.0</title>
5
+ <title>@pie-element/multiple-choice@6.3.1</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^1.4.15"
7
+ "version": "^1.4.17"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/math-rendering-module",
11
- "version": "^1.1.3"
11
+ "version": "^1.1.5"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/multiple-choice@6.3.0</title>
5
+ <title>@pie-element/multiple-choice@6.3.1</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.15/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.3/module/index.js";
1
+ import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.17/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.5/module/index.js";
3
3
  function getDefaultExportFromCjs(x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
5
  }
@@ -1259,6 +1259,7 @@ const {color: color$1} = _dll_pie_lib__render_ui;
1259
1259
  const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__render_ui;
1260
1260
  const classNames$3 = _dll_classnames;
1261
1261
  const _jsxFileName$3 = "/home/circleci/repo/packages/multiple-choice/src/choice-input.jsx";
1262
+ const CLASS_NAME = 'multiple-choice-component';
1262
1263
  const styleSheet = () => ({
1263
1264
  row: {
1264
1265
  display: 'flex',
@@ -1273,6 +1274,11 @@ const styleSheet = () => ({
1273
1274
  '& label': {
1274
1275
  color: color$1.text()
1275
1276
  }
1277
+ },
1278
+ horizontalLayout: {
1279
+ [`& .${CLASS_NAME}`]: {
1280
+ paddingRight: '8px'
1281
+ }
1276
1282
  }
1277
1283
  });
1278
1284
  const formStyleSheet = {
@@ -1291,10 +1297,9 @@ const StyledFormControlLabel = withStyles$3(formStyleSheet, {
1291
1297
  __self: undefined,
1292
1298
  __source: {
1293
1299
  fileName: _jsxFileName$3,
1294
- lineNumber: 39
1300
+ lineNumber: 46
1295
1301
  }
1296
1302
  }));
1297
- const CLASS_NAME = 'multiple-choice-component';
1298
1303
  const colorStyle = (varName, fallback) => ({
1299
1304
  [`&.${CLASS_NAME}`]: {
1300
1305
  color: `var(--choice-input-${varName}, ${fallback}) !important`
@@ -1346,7 +1351,7 @@ const StyledCheckbox = withStyles$3(inputStyles)(props => {
1346
1351
  __self: undefined,
1347
1352
  __source: {
1348
1353
  fileName: _jsxFileName$3,
1349
- lineNumber: 92
1354
+ lineNumber: 97
1350
1355
  }
1351
1356
  });
1352
1357
  });
@@ -1375,7 +1380,7 @@ const StyledRadio = withStyles$3(inputStyles)(props => {
1375
1380
  __self: undefined,
1376
1381
  __source: {
1377
1382
  fileName: _jsxFileName$3,
1378
- lineNumber: 125
1383
+ lineNumber: 130
1379
1384
  }
1380
1385
  });
1381
1386
  });
@@ -1396,7 +1401,8 @@ class ChoiceInput extends React$4.Component {
1396
1401
  classes: PropTypes$3.object,
1397
1402
  className: PropTypes$3.string,
1398
1403
  hideTick: PropTypes$3.bool,
1399
- isEvaluateMode: PropTypes$3.bool
1404
+ isEvaluateMode: PropTypes$3.bool,
1405
+ choicesLayout: PropTypes$3.oneOf(['vertical', 'grid', 'horizontal'])
1400
1406
  };
1401
1407
  }
1402
1408
  static __initStatic2() {
@@ -1418,36 +1424,39 @@ class ChoiceInput extends React$4.Component {
1418
1424
  });
1419
1425
  }
1420
1426
  render() {
1421
- const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode} = this.props;
1427
+ const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode, choicesLayout} = this.props;
1422
1428
  const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;
1423
1429
  const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';
1430
+ const holderClassNames = classNames$3(classes.checkboxHolder, {
1431
+ [classes.horizontalLayout]: choicesLayout === 'horizontal'
1432
+ });
1424
1433
  return React$4.createElement('div', {
1425
1434
  className: classNames$3(className, 'corespring-' + classSuffix, 'choice-input'),
1426
1435
  __self: this,
1427
1436
  __source: {
1428
1437
  fileName: _jsxFileName$3,
1429
- lineNumber: 197
1438
+ lineNumber: 208
1430
1439
  }
1431
1440
  }, React$4.createElement('div', {
1432
1441
  className: classes.row,
1433
1442
  __self: this,
1434
1443
  __source: {
1435
1444
  fileName: _jsxFileName$3,
1436
- lineNumber: 198
1445
+ lineNumber: 209
1437
1446
  }
1438
1447
  }, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
1439
1448
  correctness: correctness,
1440
1449
  __self: this,
1441
1450
  __source: {
1442
1451
  fileName: _jsxFileName$3,
1443
- lineNumber: 199
1452
+ lineNumber: 210
1444
1453
  }
1445
1454
  }), React$4.createElement('div', {
1446
- className: classNames$3(classes.checkboxHolder, 'checkbox-holder'),
1455
+ className: classNames$3(holderClassNames, 'checkbox-holder'),
1447
1456
  __self: this,
1448
1457
  __source: {
1449
1458
  fileName: _jsxFileName$3,
1450
- lineNumber: 200
1459
+ lineNumber: 211
1451
1460
  }
1452
1461
  }, React$4.createElement(StyledFormControlLabel, {
1453
1462
  disabled: disabled,
@@ -1460,13 +1469,13 @@ class ChoiceInput extends React$4.Component {
1460
1469
  __self: this,
1461
1470
  __source: {
1462
1471
  fileName: _jsxFileName$3,
1463
- lineNumber: 205
1472
+ lineNumber: 216
1464
1473
  }
1465
1474
  }),
1466
1475
  __self: this,
1467
1476
  __source: {
1468
1477
  fileName: _jsxFileName$3,
1469
- lineNumber: 201
1478
+ lineNumber: 212
1470
1479
  }
1471
1480
  }), React$4.createElement(PreviewPrompt$1, {
1472
1481
  className: "label",
@@ -1476,7 +1485,7 @@ class ChoiceInput extends React$4.Component {
1476
1485
  __self: this,
1477
1486
  __source: {
1478
1487
  fileName: _jsxFileName$3,
1479
- lineNumber: 213
1488
+ lineNumber: 224
1480
1489
  }
1481
1490
  }))), rationale && React$4.createElement(PreviewPrompt$1, {
1482
1491
  className: "rationale",
@@ -1485,7 +1494,7 @@ class ChoiceInput extends React$4.Component {
1485
1494
  __self: this,
1486
1495
  __source: {
1487
1496
  fileName: _jsxFileName$3,
1488
- lineNumber: 222
1497
+ lineNumber: 233
1489
1498
  }
1490
1499
  }), React$4.createElement(Feedback, {
1491
1500
  feedback: feedback,
@@ -1493,7 +1502,7 @@ class ChoiceInput extends React$4.Component {
1493
1502
  __self: this,
1494
1503
  __source: {
1495
1504
  fileName: _jsxFileName$3,
1496
- lineNumber: 224
1505
+ lineNumber: 235
1497
1506
  }
1498
1507
  }));
1499
1508
  }
@@ -1537,7 +1546,8 @@ class Choice extends React$3.Component {
1537
1546
  isEvaluateMode
1538
1547
  };
1539
1548
  const names = classNames$2(classes.choice, {
1540
- [classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical'
1549
+ [classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
1550
+ [classes.horizontalLayout]: choicesLayout === 'horizontal'
1541
1551
  });
1542
1552
  return React$3.createElement('div', {
1543
1553
  className: choiceClass,
@@ -1545,7 +1555,7 @@ class Choice extends React$3.Component {
1545
1555
  __self: this,
1546
1556
  __source: {
1547
1557
  fileName: _jsxFileName$2,
1548
- lineNumber: 56
1558
+ lineNumber: 57
1549
1559
  }
1550
1560
  }, React$3.createElement(ChoiceInput$1, {
1551
1561
  ...choiceProps,
@@ -1553,7 +1563,7 @@ class Choice extends React$3.Component {
1553
1563
  __self: this,
1554
1564
  __source: {
1555
1565
  fileName: _jsxFileName$2,
1556
- lineNumber: 57
1566
+ lineNumber: 58
1557
1567
  }
1558
1568
  }));
1559
1569
  }
@@ -1582,6 +1592,12 @@ var StyledChoice = withStyles$2({
1582
1592
  },
1583
1593
  noBorder: {
1584
1594
  borderBottom: 'none'
1595
+ },
1596
+ horizontalLayout: {
1597
+ paddingRight: '20px',
1598
+ '& label': {
1599
+ marginRight: '8px'
1600
+ }
1585
1601
  }
1586
1602
  })(Choice);
1587
1603
  const React$2 = _dll_react;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "6.3.1",
4
+ "version": "6.3.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-lib/config-ui": "^10.12.2",
10
+ "@pie-lib/config-ui": "^10.13.0",
11
11
  "@pie-lib/correct-answer-toggle": "^2.3.36",
12
12
  "@pie-lib/math-rendering": "^2.4.0",
13
13
  "@pie-lib/render-ui": "^4.12.6",
@@ -21,7 +21,7 @@
21
21
  "react-test-renderer": "^16.3.2",
22
22
  "react-transition-group": "^2.3.1"
23
23
  },
24
- "gitHead": "43f534de577f1eb49e63c8dc43d5519754d4df93",
24
+ "gitHead": "8ea971e13e74d785cd35a04fd9fe1abe1fa2dabf",
25
25
  "scripts": {
26
26
  "postpublish": "../../scripts/postpublish"
27
27
  },