@pie-lib/render-ui 4.11.9 → 4.12.1-next.86

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.json CHANGED
@@ -918,5 +918,20 @@
918
918
  "committerDate": "2021-08-04 11:33:03 +0300",
919
919
  "isTagged": true,
920
920
  "tag": "@pie-lib/render-ui@4.11.9"
921
+ },
922
+ {
923
+ "type": "feat",
924
+ "scope": "preview-prompt",
925
+ "subject": "add defaultClassName prop for static classname for pie-print",
926
+ "merge": null,
927
+ "header": "feat(preview-prompt): add defaultClassName prop for static classname for pie-print",
928
+ "body": null,
929
+ "footer": null,
930
+ "notes": [],
931
+ "hash": "7ca55ba0daaa807f9157f5cb1825ca620dba1672",
932
+ "gitTags": "",
933
+ "committerDate": "2021-08-30 11:27:45 +0300",
934
+ "isTagged": true,
935
+ "tag": "@pie-lib/render-ui@4.12.0"
921
936
  }
922
937
  ]
package/CHANGELOG.md CHANGED
@@ -3,156 +3,105 @@
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.11.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.8...@pie-lib/render-ui@4.11.9) (2021-08-04)
6
+ # [4.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.9...@pie-lib/render-ui@4.12.0) (2021-08-30)
7
7
 
8
8
 
9
- ### Bug Fixes
9
+ ### Features
10
10
 
11
- * **render-ui:** text should serve as selector for multiple-choice questions PD-1227 ([133549b](https://github.com/pie-framework/pie-lib/commit/133549b))
11
+ * **preview-prompt:** add defaultClassName prop for static classname for pie-print ([7ca55ba](https://github.com/pie-framework/pie-lib/commit/7ca55ba))
12
12
 
13
13
 
14
14
 
15
15
 
16
16
 
17
- ## [4.11.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.7...@pie-lib/render-ui@4.11.8) (2021-07-23)
17
+ ## [4.11.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.8...@pie-lib/render-ui@4.11.9) (2021-08-04)
18
18
 
19
19
 
20
20
  ### Bug Fixes
21
21
 
22
- * **editable-html:** add refs for editors, fix propTypes warnings for PD-1230 ([c6e3a2a](https://github.com/pie-framework/pie-lib/commit/c6e3a2a))
23
-
22
+ * **render-ui:** text should serve as selector for multiple-choice questions PD-1227 ([133549b](https://github.com/pie-framework/pie-lib/commit/133549b))
24
23
 
25
24
 
26
25
 
27
26
 
28
- ## [4.11.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.5...@pie-lib/render-ui@4.11.7) (2021-06-25)
29
27
 
30
- **Note:** Version bump only for package @pie-lib/render-ui
28
+ ## [4.11.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.7...@pie-lib/render-ui@4.11.8) (2021-07-23)
31
29
 
30
+ ### Bug Fixes
32
31
 
32
+ - **editable-html:** add refs for editors, fix propTypes warnings for PD-1230 ([c6e3a2a](https://github.com/pie-framework/pie-lib/commit/c6e3a2a))
33
33
 
34
+ ## [4.11.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.5...@pie-lib/render-ui@4.11.7) (2021-06-25)
34
35
 
36
+ **Note:** Version bump only for package @pie-lib/render-ui
35
37
 
36
38
  ## [4.11.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.4...@pie-lib/render-ui@4.11.5) (2021-03-01)
37
39
 
38
40
  **Note:** Version bump only for package @pie-lib/render-ui
39
41
 
40
-
41
-
42
-
43
-
44
42
  ## [4.11.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.3...@pie-lib/render-ui@4.11.4) (2021-03-01)
45
43
 
46
-
47
44
  ### Bug Fixes
48
45
 
49
- * **render-ui:** create function that parses html in order to fix PD-771 ([6bf9c5d](https://github.com/pie-framework/pie-lib/commit/6bf9c5d))
50
- * **render-ui:** render math for collapsible to fix PD-772 ([f0ef384](https://github.com/pie-framework/pie-lib/commit/f0ef384))
51
-
52
-
53
-
54
-
46
+ - **render-ui:** create function that parses html in order to fix PD-771 ([6bf9c5d](https://github.com/pie-framework/pie-lib/commit/6bf9c5d))
47
+ - **render-ui:** render math for collapsible to fix PD-772 ([f0ef384](https://github.com/pie-framework/pie-lib/commit/f0ef384))
55
48
 
56
49
  ## [4.11.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.2...@pie-lib/render-ui@4.11.3) (2021-02-15)
57
50
 
58
51
  **Note:** Version bump only for package @pie-lib/render-ui
59
52
 
60
-
61
-
62
-
63
-
64
53
  ## [4.11.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.11.0...@pie-lib/render-ui@4.11.2) (2021-02-15)
65
54
 
66
55
  **Note:** Version bump only for package @pie-lib/render-ui
67
56
 
68
-
69
-
70
-
71
-
72
57
  # [4.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.10.4...@pie-lib/render-ui@4.11.0) (2021-02-15)
73
58
 
74
-
75
59
  ### Features
76
60
 
77
- * **render-ui:** add secondary background color ([c9cc0a8](https://github.com/pie-framework/pie-lib/commit/c9cc0a8))
78
-
79
-
80
-
81
-
61
+ - **render-ui:** add secondary background color ([c9cc0a8](https://github.com/pie-framework/pie-lib/commit/c9cc0a8))
82
62
 
83
63
  ## [4.10.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.10.3...@pie-lib/render-ui@4.10.4) (2021-02-01)
84
64
 
85
65
  **Note:** Version bump only for package @pie-lib/render-ui
86
66
 
87
-
88
-
89
-
90
-
91
67
  ## [4.10.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.10.2...@pie-lib/render-ui@4.10.3) (2021-01-28)
92
68
 
93
-
94
69
  ### Bug Fixes
95
70
 
96
- * **render-ui:** make sure prompt replace has a value ([093fef7](https://github.com/pie-framework/pie-lib/commit/093fef7))
97
-
98
-
99
-
100
-
71
+ - **render-ui:** make sure prompt replace has a value ([093fef7](https://github.com/pie-framework/pie-lib/commit/093fef7))
101
72
 
102
73
  ## [4.10.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.10.1...@pie-lib/render-ui@4.10.2) (2021-01-28)
103
74
 
104
75
  **Note:** Version bump only for package @pie-lib/render-ui
105
76
 
106
-
107
-
108
-
109
-
110
77
  ## [4.10.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.10.0...@pie-lib/render-ui@4.10.1) (2021-01-25)
111
78
 
112
79
  **Note:** Version bump only for package @pie-lib/render-ui
113
80
 
114
-
115
-
116
-
117
-
118
81
  # [4.10.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.9.4...@pie-lib/render-ui@4.10.0) (2021-01-11)
119
82
 
120
-
121
83
  ### Features
122
84
 
123
- * **render-ui:** add readable component for pie tagging ([5b76d67](https://github.com/pie-framework/pie-lib/commit/5b76d67))
124
- * **render-ui:** pie-purpose wrapper component added - PD-579 ([308f553](https://github.com/pie-framework/pie-lib/commit/308f553))
125
-
126
-
127
-
128
-
85
+ - **render-ui:** add readable component for pie tagging ([5b76d67](https://github.com/pie-framework/pie-lib/commit/5b76d67))
86
+ - **render-ui:** pie-purpose wrapper component added - PD-579 ([308f553](https://github.com/pie-framework/pie-lib/commit/308f553))
129
87
 
130
88
  ## [4.9.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.9.3...@pie-lib/render-ui@4.9.4) (2020-10-29)
131
89
 
132
-
133
90
  ### Bug Fixes
134
91
 
135
- * Authored table borders are not visible in preview PD-342 ([cb86c55](https://github.com/pie-framework/pie-lib/commit/cb86c55))
136
- * formatting ([754bb75](https://github.com/pie-framework/pie-lib/commit/754bb75))
137
- * Modified code for suggested changes and addes snapshots PD-342 ([fbaa88e](https://github.com/pie-framework/pie-lib/commit/fbaa88e))
138
- * Modified code for suggested changes and addes snapshots PD-342 ([dd43627](https://github.com/pie-framework/pie-lib/commit/dd43627))
139
- * Modified code for suggested changes and addes snapshots PD-342 ([d9b76db](https://github.com/pie-framework/pie-lib/commit/d9b76db))
140
- * removed console log that are added in test file PD-342 ([2c9d2e5](https://github.com/pie-framework/pie-lib/commit/2c9d2e5))
141
- * snapshot test ([a86e5e8](https://github.com/pie-framework/pie-lib/commit/a86e5e8))
142
- * typo ([0cb17c9](https://github.com/pie-framework/pie-lib/commit/0cb17c9))
143
-
144
-
145
-
146
-
92
+ - Authored table borders are not visible in preview PD-342 ([cb86c55](https://github.com/pie-framework/pie-lib/commit/cb86c55))
93
+ - formatting ([754bb75](https://github.com/pie-framework/pie-lib/commit/754bb75))
94
+ - Modified code for suggested changes and addes snapshots PD-342 ([fbaa88e](https://github.com/pie-framework/pie-lib/commit/fbaa88e))
95
+ - Modified code for suggested changes and addes snapshots PD-342 ([dd43627](https://github.com/pie-framework/pie-lib/commit/dd43627))
96
+ - Modified code for suggested changes and addes snapshots PD-342 ([d9b76db](https://github.com/pie-framework/pie-lib/commit/d9b76db))
97
+ - removed console log that are added in test file PD-342 ([2c9d2e5](https://github.com/pie-framework/pie-lib/commit/2c9d2e5))
98
+ - snapshot test ([a86e5e8](https://github.com/pie-framework/pie-lib/commit/a86e5e8))
99
+ - typo ([0cb17c9](https://github.com/pie-framework/pie-lib/commit/0cb17c9))
147
100
 
148
101
  ## [4.9.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.9.2...@pie-lib/render-ui@4.9.3) (2020-10-26)
149
102
 
150
103
  **Note:** Version bump only for package @pie-lib/render-ui
151
104
 
152
-
153
-
154
-
155
-
156
105
  ## [4.9.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.9.1...@pie-lib/render-ui@4.9.2) (2020-10-26)
157
106
 
158
107
  **Note:** Version bump only for package @pie-lib/render-ui
@@ -60,9 +60,10 @@ function (_Component) {
60
60
  classes = _this$props.classes,
61
61
  tagName = _this$props.tagName,
62
62
  className = _this$props.className,
63
- onClick = _this$props.onClick;
63
+ onClick = _this$props.onClick,
64
+ defaultClassName = _this$props.defaultClassName;
64
65
  var CustomTag = tagName || 'div';
65
- var customClasses = "".concat(classes.promptTable, " ").concat(classes[className] || '', " ");
66
+ var customClasses = "".concat(classes.promptTable, " ").concat(classes[className] || '', " ").concat(defaultClassName || '');
66
67
  return _react["default"].createElement(CustomTag, {
67
68
  onClick: onClick,
68
69
  className: customClasses,
@@ -83,7 +84,8 @@ _defineProperty(PreviewPrompt, "propTypes", {
83
84
  prompt: _propTypes["default"].string,
84
85
  tagName: _propTypes["default"].string,
85
86
  className: _propTypes["default"].string,
86
- onClick: _propTypes["default"].func
87
+ onClick: _propTypes["default"].func,
88
+ defaultClassName: _propTypes["default"].string
87
89
  });
88
90
 
89
91
  _defineProperty(PreviewPrompt, "defaultProps", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/preview-prompt.jsx"],"names":["NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","PreviewPrompt","props","prompt","classes","tagName","className","onClick","CustomTag","customClasses","promptTable","__html","replace","Component","PropTypes","object","string","func","styles","theme","verticalAlign","color","text","rationale","paddingLeft","spacing","unit","label","display","cursor","borderCollapse","borderTop","backgroundColor","border","padding","textAlign"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA,IAAMA,mBAAmB,GAAG,yBAA5B;AACA,IAAMC,aAAa,GAAG,YAAtB;;IAEaC,a;;;;;;;;;;;;;6BAaF;AAAA,wBACkD,KAAKC,KADvD;AAAA,UACCC,MADD,eACCA,MADD;AAAA,UACSC,OADT,eACSA,OADT;AAAA,UACkBC,OADlB,eACkBA,OADlB;AAAA,UAC2BC,SAD3B,eAC2BA,SAD3B;AAAA,UACsCC,OADtC,eACsCA,OADtC;AAEP,UAAMC,SAAS,GAAGH,OAAO,IAAI,KAA7B;AACA,UAAMI,aAAa,aAAML,OAAO,CAACM,WAAd,cAA6BN,OAAO,CAACE,SAAD,CAAP,IAAsB,EAAnD,MAAnB;AAEA,aACE,gCAAC,SAAD;AACE,QAAA,OAAO,EAAEC,OADX;AAEE,QAAA,SAAS,EAAEE,aAFb;AAGE,QAAA,uBAAuB,EAAE;AACvBE,UAAAA,MAAM,EAAE,CAACR,MAAM,IAAI,EAAX,EAAeS,OAAf,CAAuBb,mBAAvB,EAA4CC,aAA5C;AADe;AAH3B,QADF;AASD;;;;EA3BgCa,gB;;;;gBAAtBZ,a,eACQ;AACjBG,EAAAA,OAAO,EAAEU,sBAAUC,MADF;AAEjBZ,EAAAA,MAAM,EAAEW,sBAAUE,MAFD;AAGjBX,EAAAA,OAAO,EAAES,sBAAUE,MAHF;AAIjBV,EAAAA,SAAS,EAAEQ,sBAAUE,MAJJ;AAKjBT,EAAAA,OAAO,EAAEO,sBAAUG;AALF,C;;gBADRhB,a,kBASW;AACpBM,EAAAA,OAAO,EAAE,mBAAM,CAAE;AADG,C;;AAqBxB,IAAMW,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBhB,IAAAA,MAAM,EAAE;AACNiB,MAAAA,aAAa,EAAE,QADT;AAENC,MAAAA,KAAK,EAAEA,KAAK,CAACC,IAAN;AAFD,KADe;AAKvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,WAAW,EAAEL,KAAK,CAACM,OAAN,CAAcC,IAAd,GAAqB;AADzB,KALY;AAQvBC,IAAAA,KAAK,EAAE;AACLN,MAAAA,KAAK,YAAKA,KAAK,CAACC,IAAN,EAAL,gBADA;AACgC;AACrCM,MAAAA,OAAO,EAAE,cAFJ;AAGLR,MAAAA,aAAa,EAAE,QAHV;AAILS,MAAAA,MAAM,EAAE;AAJH,KARgB;AAcvBnB,IAAAA,WAAW,EAAE;AACX,iCAA2B;AACzBoB,QAAAA,cAAc,EAAE;AADS,OADhB;AAIX,oCAA8B;AAC5BC,QAAAA,SAAS,EAAE,mBADiB;AAE5B,2BAAmB;AACjBC,UAAAA,eAAe,EAAE;AADA;AAFS,OAJnB;AAUX,gEAA0D;AACxDC,QAAAA,MAAM,EAAE,mBADgD;AAExDC,QAAAA,OAAO,EAAE,UAF+C;AAGxDC,QAAAA,SAAS,EAAE;AAH6C;AAV/C;AAdU,GAAL;AAAA,CAApB;;eA+Be,wBAAWjB,MAAX,EAAmBjB,aAAnB,C","sourcesContent":["import React, { Component } from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport * as color from './color';\n\n//Used these below to replace \\\\embed{newLine} with \\\\newline from prompt which will get parsed in MathJax\nconst NEWLINE_BLOCK_REGEX = /\\\\embed\\{newLine\\}\\[\\]/g;\nconst NEWLINE_LATEX = '\\\\newline ';\n\nexport class PreviewPrompt extends Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n tagName: PropTypes.string,\n className: PropTypes.string,\n onClick: PropTypes.func\n };\n\n static defaultProps = {\n onClick: () => {}\n };\n\n render() {\n const { prompt, classes, tagName, className, onClick } = this.props;\n const CustomTag = tagName || 'div';\n const customClasses = `${classes.promptTable} ${classes[className] || ''} `;\n\n return (\n <CustomTag\n onClick={onClick}\n className={customClasses}\n dangerouslySetInnerHTML={{\n __html: (prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX)\n }}\n />\n );\n }\n}\n\nconst styles = theme => ({\n prompt: {\n verticalAlign: 'middle',\n color: color.text()\n },\n rationale: {\n paddingLeft: theme.spacing.unit * 16\n },\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)',\n display: 'inline-block',\n verticalAlign: 'middle',\n cursor: 'pointer'\n },\n promptTable: {\n '&:not(.MathJax) > table': {\n borderCollapse: 'collapse'\n },\n '&:not(.MathJax) > table tr': {\n borderTop: '1px solid #dfe2e5',\n '&:nth-child(2n)': {\n backgroundColor: '#f6f8fa'\n }\n },\n '&:not(.MathJax) > table td, &:not(.MathJax) > table th': {\n border: '1px solid #dfe2e5',\n padding: '.6em 1em',\n textAlign: 'center'\n }\n }\n});\nexport default withStyles(styles)(PreviewPrompt);\n"],"file":"preview-prompt.js"}
1
+ {"version":3,"sources":["../src/preview-prompt.jsx"],"names":["NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","PreviewPrompt","props","prompt","classes","tagName","className","onClick","defaultClassName","CustomTag","customClasses","promptTable","__html","replace","Component","PropTypes","object","string","func","styles","theme","verticalAlign","color","text","rationale","paddingLeft","spacing","unit","label","display","cursor","borderCollapse","borderTop","backgroundColor","border","padding","textAlign"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA,IAAMA,mBAAmB,GAAG,yBAA5B;AACA,IAAMC,aAAa,GAAG,YAAtB;;IAEaC,a;;;;;;;;;;;;;6BAcF;AAAA,wBACoE,KAAKC,KADzE;AAAA,UACCC,MADD,eACCA,MADD;AAAA,UACSC,OADT,eACSA,OADT;AAAA,UACkBC,OADlB,eACkBA,OADlB;AAAA,UAC2BC,SAD3B,eAC2BA,SAD3B;AAAA,UACsCC,OADtC,eACsCA,OADtC;AAAA,UAC+CC,gBAD/C,eAC+CA,gBAD/C;AAEP,UAAMC,SAAS,GAAGJ,OAAO,IAAI,KAA7B;AACA,UAAMK,aAAa,aAAMN,OAAO,CAACO,WAAd,cAA6BP,OAAO,CAACE,SAAD,CAAP,IAAsB,EAAnD,cAAyDE,gBAAgB,IAC1F,EADiB,CAAnB;AAGA,aACE,gCAAC,SAAD;AACE,QAAA,OAAO,EAAED,OADX;AAEE,QAAA,SAAS,EAAEG,aAFb;AAGE,QAAA,uBAAuB,EAAE;AACvBE,UAAAA,MAAM,EAAE,CAACT,MAAM,IAAI,EAAX,EAAeU,OAAf,CAAuBd,mBAAvB,EAA4CC,aAA5C;AADe;AAH3B,QADF;AASD;;;;EA7BgCc,gB;;;;gBAAtBb,a,eACQ;AACjBG,EAAAA,OAAO,EAAEW,sBAAUC,MADF;AAEjBb,EAAAA,MAAM,EAAEY,sBAAUE,MAFD;AAGjBZ,EAAAA,OAAO,EAAEU,sBAAUE,MAHF;AAIjBX,EAAAA,SAAS,EAAES,sBAAUE,MAJJ;AAKjBV,EAAAA,OAAO,EAAEQ,sBAAUG,IALF;AAMjBV,EAAAA,gBAAgB,EAAEO,sBAAUE;AANX,C;;gBADRhB,a,kBAUW;AACpBM,EAAAA,OAAO,EAAE,mBAAM,CAAE;AADG,C;;AAsBxB,IAAMY,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBjB,IAAAA,MAAM,EAAE;AACNkB,MAAAA,aAAa,EAAE,QADT;AAENC,MAAAA,KAAK,EAAEA,KAAK,CAACC,IAAN;AAFD,KADe;AAKvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,WAAW,EAAEL,KAAK,CAACM,OAAN,CAAcC,IAAd,GAAqB;AADzB,KALY;AAQvBC,IAAAA,KAAK,EAAE;AACLN,MAAAA,KAAK,YAAKA,KAAK,CAACC,IAAN,EAAL,gBADA;AACgC;AACrCM,MAAAA,OAAO,EAAE,cAFJ;AAGLR,MAAAA,aAAa,EAAE,QAHV;AAILS,MAAAA,MAAM,EAAE;AAJH,KARgB;AAcvBnB,IAAAA,WAAW,EAAE;AACX,iCAA2B;AACzBoB,QAAAA,cAAc,EAAE;AADS,OADhB;AAIX,oCAA8B;AAC5BC,QAAAA,SAAS,EAAE,mBADiB;AAE5B,2BAAmB;AACjBC,UAAAA,eAAe,EAAE;AADA;AAFS,OAJnB;AAUX,gEAA0D;AACxDC,QAAAA,MAAM,EAAE,mBADgD;AAExDC,QAAAA,OAAO,EAAE,UAF+C;AAGxDC,QAAAA,SAAS,EAAE;AAH6C;AAV/C;AAdU,GAAL;AAAA,CAApB;;eA+Be,wBAAWjB,MAAX,EAAmBlB,aAAnB,C","sourcesContent":["import React, { Component } from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport * as color from './color';\n\n//Used these below to replace \\\\embed{newLine} with \\\\newline from prompt which will get parsed in MathJax\nconst NEWLINE_BLOCK_REGEX = /\\\\embed\\{newLine\\}\\[\\]/g;\nconst NEWLINE_LATEX = '\\\\newline ';\n\nexport class PreviewPrompt extends Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n tagName: PropTypes.string,\n className: PropTypes.string,\n onClick: PropTypes.func,\n defaultClassName: PropTypes.string\n };\n\n static defaultProps = {\n onClick: () => {}\n };\n\n render() {\n const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;\n const CustomTag = tagName || 'div';\n const customClasses = `${classes.promptTable} ${classes[className] || ''} ${defaultClassName ||\n ''}`;\n\n return (\n <CustomTag\n onClick={onClick}\n className={customClasses}\n dangerouslySetInnerHTML={{\n __html: (prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX)\n }}\n />\n );\n }\n}\n\nconst styles = theme => ({\n prompt: {\n verticalAlign: 'middle',\n color: color.text()\n },\n rationale: {\n paddingLeft: theme.spacing.unit * 16\n },\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)',\n display: 'inline-block',\n verticalAlign: 'middle',\n cursor: 'pointer'\n },\n promptTable: {\n '&:not(.MathJax) > table': {\n borderCollapse: 'collapse'\n },\n '&:not(.MathJax) > table tr': {\n borderTop: '1px solid #dfe2e5',\n '&:nth-child(2n)': {\n backgroundColor: '#f6f8fa'\n }\n },\n '&:not(.MathJax) > table td, &:not(.MathJax) > table th': {\n border: '1px solid #dfe2e5',\n padding: '.6em 1em',\n textAlign: 'center'\n }\n }\n});\nexport default withStyles(styles)(PreviewPrompt);\n"],"file":"preview-prompt.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/render-ui",
3
- "version": "4.11.9",
3
+ "version": "4.12.1-next.86+f45a2d2e",
4
4
  "description": "Some shared ui elements when rendering - but not worthy of their own package yet.",
5
5
  "module": "src/index.js",
6
6
  "main": "lib/index.js",
@@ -12,7 +12,7 @@
12
12
  "@material-ui/core": "^3.8.3",
13
13
  "@material-ui/icons": "^3.0.2",
14
14
  "@pie-lib/icons": "^2.4.25",
15
- "@pie-lib/math-rendering": "^2.3.8",
15
+ "@pie-lib/math-rendering": "^2.3.10-next.86+f45a2d2e",
16
16
  "classnames": "^2.2.6",
17
17
  "debug": "^4.1.1",
18
18
  "prop-types": "^15.7.2",
@@ -26,5 +26,5 @@
26
26
  "react": "^16.8.1",
27
27
  "react-dom": "^16.8.1"
28
28
  },
29
- "gitHead": "56221a582d73a6c4e734d97b7b6b6c9487cb6013"
29
+ "gitHead": "f45a2d2e117fa21914e67a74c97fbec724227986"
30
30
  }
@@ -13,7 +13,8 @@ export class PreviewPrompt extends Component {
13
13
  prompt: PropTypes.string,
14
14
  tagName: PropTypes.string,
15
15
  className: PropTypes.string,
16
- onClick: PropTypes.func
16
+ onClick: PropTypes.func,
17
+ defaultClassName: PropTypes.string
17
18
  };
18
19
 
19
20
  static defaultProps = {
@@ -21,9 +22,10 @@ export class PreviewPrompt extends Component {
21
22
  };
22
23
 
23
24
  render() {
24
- const { prompt, classes, tagName, className, onClick } = this.props;
25
+ const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;
25
26
  const CustomTag = tagName || 'div';
26
- const customClasses = `${classes.promptTable} ${classes[className] || ''} `;
27
+ const customClasses = `${classes.promptTable} ${classes[className] || ''} ${defaultClassName ||
28
+ ''}`;
27
29
 
28
30
  return (
29
31
  <CustomTag