@pie-element/passage 2.21.4-next.3 → 2.21.5-next.16

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.
@@ -83,6 +83,10 @@ var styles = function styles(theme) {
83
83
  };
84
84
  };
85
85
 
86
+ var getContent = function getContent(html) {
87
+ return (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi, '');
88
+ };
89
+
86
90
  var StimulusTabs = /*#__PURE__*/function (_React$Component) {
87
91
  (0, _inherits2["default"])(StimulusTabs, _React$Component);
88
92
 
@@ -195,10 +199,10 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
195
199
 
196
200
  (0, _createClass2["default"])(StimulusTabs, [{
197
201
  key: "renderInstructions",
198
- value: function renderInstructions(showTeacherInstructions, teacherInstructions) {
199
- var disabledTabs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
202
+ value: function renderInstructions(teacherInstructions) {
203
+ var disabledTabs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
200
204
 
201
- if (!showTeacherInstructions || !teacherInstructions) {
205
+ if (!getContent(teacherInstructions)) {
202
206
  return;
203
207
  }
204
208
 
@@ -222,7 +226,7 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
222
226
  }
223
227
  }, {
224
228
  key: "renderTab",
225
- value: function renderTab(tab, showTeacherInstructions, disabledTabs) {
229
+ value: function renderTab(tab, disabledTabs) {
226
230
  var classes = this.props.classes;
227
231
  return /*#__PURE__*/_react["default"].createElement("div", {
228
232
  className: (0, _classnames["default"])(classes.passage, 'passage'),
@@ -230,22 +234,22 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
230
234
  id: "tabpanel-".concat(tab.id),
231
235
  role: "tabpanel",
232
236
  "aria-labelledby": "button-".concat(tab.id)
233
- }, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), /*#__PURE__*/_react["default"].createElement("h2", null, /*#__PURE__*/_react["default"].createElement("div", {
237
+ }, this.renderInstructions(tab.teacherInstructions, disabledTabs), (getContent(tab.title) || getContent(tab.subtitle)) && /*#__PURE__*/_react["default"].createElement("h2", null, getContent(tab.title) && /*#__PURE__*/_react["default"].createElement("div", {
234
238
  className: (0, _classnames["default"])(classes.passageTitle, 'title'),
235
239
  dangerouslySetInnerHTML: {
236
240
  __html: this.parsedText(tab.title)
237
241
  }
238
- }), /*#__PURE__*/_react["default"].createElement("div", {
242
+ }), getContent(tab.subtitle) && /*#__PURE__*/_react["default"].createElement("div", {
239
243
  className: (0, _classnames["default"])(classes.passageSubtitle, 'subtitle'),
240
244
  dangerouslySetInnerHTML: {
241
245
  __html: this.parsedText(tab.subtitle)
242
246
  }
243
- })), /*#__PURE__*/_react["default"].createElement("div", {
247
+ })), getContent(tab.author) && /*#__PURE__*/_react["default"].createElement("div", {
244
248
  className: (0, _classnames["default"])(classes.passageAuthor, 'author'),
245
249
  dangerouslySetInnerHTML: {
246
250
  __html: this.parsedText(tab.author)
247
251
  }
248
- }), /*#__PURE__*/_react["default"].createElement("div", {
252
+ }), getContent(tab.text) && /*#__PURE__*/_react["default"].createElement("div", {
249
253
  key: tab.id,
250
254
  className: (0, _classnames["default"])(classes.passageText, 'text'),
251
255
  dangerouslySetInnerHTML: {
@@ -261,8 +265,7 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
261
265
  var _this$props = this.props,
262
266
  classes = _this$props.classes,
263
267
  tabs = _this$props.tabs,
264
- disabledTabs = _this$props.disabledTabs,
265
- showTeacherInstructions = _this$props.showTeacherInstructions;
268
+ disabledTabs = _this$props.disabledTabs;
266
269
  var activeTab = this.state.activeTab;
267
270
 
268
271
  if (!(tabs !== null && tabs !== void 0 && tabs.length)) {
@@ -275,7 +278,7 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
275
278
  return /*#__PURE__*/_react["default"].createElement("div", {
276
279
  className: (0, _classnames["default"])(classes.passages, 'passages')
277
280
  }, disabledTabs || tabs.length === 1 ? tabs.map(function (tab) {
278
- return _this2.renderTab(tab, showTeacherInstructions, disabledTabs);
281
+ return _this2.renderTab(tab, disabledTabs);
279
282
  }) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
280
283
  classes: {
281
284
  root: classes.stickyTabs,
@@ -290,7 +293,7 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
290
293
  id: "button-".concat(tab.id),
291
294
  label: /*#__PURE__*/_react["default"].createElement("span", {
292
295
  dangerouslySetInnerHTML: {
293
- __html: _this2.parsedText(tab.title)
296
+ __html: _this2.parsedText(tab.label)
294
297
  }
295
298
  }),
296
299
  value: tab.id,
@@ -304,7 +307,7 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
304
307
  return _this2.handleKeyDown(event, tab.id);
305
308
  }
306
309
  });
307
- })), selectedTab ? this.renderTab(selectedTab, showTeacherInstructions, disabledTabs) : null));
310
+ })), selectedTab ? this.renderTab(selectedTab, disabledTabs) : null));
308
311
  }
309
312
  }]);
310
313
  return StimulusTabs;
@@ -314,14 +317,14 @@ StimulusTabs.propTypes = {
314
317
  classes: _propTypes["default"].object.isRequired,
315
318
  tabs: _propTypes["default"].arrayOf(_propTypes["default"].shape({
316
319
  id: _propTypes["default"].number.isRequired,
320
+ label: _propTypes["default"].string.isRequired,
317
321
  title: _propTypes["default"].string.isRequired,
318
322
  subtitle: _propTypes["default"].string,
319
323
  author: _propTypes["default"].string,
320
324
  text: _propTypes["default"].string.isRequired,
321
325
  teacherInstructions: _propTypes["default"].string
322
326
  }).isRequired).isRequired,
323
- disabledTabs: _propTypes["default"].bool,
324
- showTeacherInstructions: _propTypes["default"].bool
327
+ disabledTabs: _propTypes["default"].bool
325
328
  };
326
329
 
327
330
  var _default = (0, _styles.withStyles)(styles)(StimulusTabs);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/stimulus-tabs.jsx"],"names":["styles","theme","passages","flexGrow","backgroundColor","color","background","text","passage","padding","spacing","unit","passageTitle","fontSize","passageSubtitle","passageAuthor","passageText","stickyTabs","position","top","tab","palette","common","white","black","tabButton","teacherInstructions","marginBottom","StimulusTabs","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","window","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","handleChange","document","getElementById","focus","div","createElement","innerHTML","replace","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","showTeacherInstructions","disabledTabs","teacherInstructionsDiv","hidden","visible","classes","renderInstructions","__html","parsedText","title","subtitle","author","state","selectedTab","find","map","renderTab","root","flexContainer","handleKeyDown","React","Component","propTypes","PropTypes","object","isRequired","arrayOf","shape","number","string","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,QAAQ,EAAE,CADF;AAERC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAFT;AAGRD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAHC,KADe;AAMzBC,IAAAA,OAAO,EAAE;AACPJ,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADV;AAEPD,MAAAA,KAAK,EAAEA,gBAAME,IAAN,EAFA;AAGPE,MAAAA,OAAO,EAAER,KAAK,CAACS,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KANgB;AAWzBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,QAAQ,EAAE;AADE,KAXW;AAczBC,IAAAA,eAAe,EAAE;AACfD,MAAAA,QAAQ,EAAE;AADK,KAdQ;AAiBzBE,IAAAA,aAAa,EAAE;AACbF,MAAAA,QAAQ,EAAE;AADG,KAjBU;AAoBzBG,IAAAA,WAAW,EAAE,EApBY;AAqBzBC,IAAAA,UAAU,EAAE;AACVX,MAAAA,UAAU,EAAED,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abs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapsible, color, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport classNames from 'classnames';\n\nconst styles = (theme) => ({\n passages: {\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n },\n passage: {\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing.unit * 2,\n },\n passageTitle: {\n fontSize: '1.75rem',\n },\n passageSubtitle: {\n fontSize: '1.5rem',\n },\n passageAuthor: {\n fontSize: '1.25rem',\n },\n passageText: {},\n stickyTabs: {\n background: color.background(),\n position: 'sticky',\n top: 0,\n },\n tab: {\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n fontSize: 'inherit',\n color: theme.palette.common.black, // remove when PD-2801 is DONE\n },\n tabButton: {\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n },\n teacherInstructions: {\n marginBottom: theme.spacing.unit * 2,\n },\n});\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n };\n\n handleChange = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n this.handleChange(event, tabs[newTabIndex].id);\n document.getElementById(`button-${tabs[newTabIndex].id}`).focus();\n }\n };\n\n parsedText = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = text.replace(/(<br\\/>\\n)/g, '<br/>');\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(showTeacherInstructions, teacherInstructions, disabledTabs = false) {\n if (!showTeacherInstructions || !teacherInstructions) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n renderTab(tab, showTeacherInstructions, disabledTabs) {\n const { classes } = this.props;\n\n return (\n <div\n className={classNames(classes.passage, 'passage')}\n key={tab.id}\n id={`tabpanel-${tab.id}`}\n role=\"tabpanel\"\n aria-labelledby={`button-${tab.id}`}\n >\n {this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs)}\n <h2>\n <div\n className={classNames(classes.passageTitle, 'title')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}\n />\n <div\n className={classNames(classes.passageSubtitle, 'subtitle')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }}\n />\n </h2>\n <div\n className={classNames(classes.passageAuthor, 'author')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }}\n />\n <div\n key={tab.id}\n className={classNames(classes.passageText, 'text')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }}\n />\n </div>\n );\n }\n\n render() {\n const { classes, tabs, disabledTabs, showTeacherInstructions } = this.props;\n const { activeTab } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n return (\n <div className={classNames(classes.passages, 'passages')}>\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, showTeacherInstructions, disabledTabs))\n ) : (\n <>\n <Tabs\n classes={{\n root: classes.stickyTabs,\n flexContainer: classes.tabButton,\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab) => (\n <Tab\n className={classes.tab}\n key={tab.id}\n id={`button-${tab.id}`}\n label={<span dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />}\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={`tabpanel-${tab.id}`}\n aria-selected={activeTab === tab.id}\n onFocus={() => this.handleChange(null, tab.id)}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, showTeacherInstructions, disabledTabs) : null}\n </>\n )}\n </div>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n classes: PropTypes.object.isRequired,\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n showTeacherInstructions: PropTypes.bool,\n};\n\nexport default withStyles(styles)(StimulusTabs);\n"],"file":"stimulus-tabs.js"}
1
+ {"version":3,"sources":["../src/stimulus-tabs.jsx"],"names":["styles","theme","passages","flexGrow","backgroundColor","color","background","text","passage","padding","spacing","unit","passageTitle","fontSize","passageSubtitle","passageAuthor","passageText","stickyTabs","position","top","tab","palette","common","white","black","tabButton","teacherInstructions","marginBottom","getContent","html","replace","StimulusTabs","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","window","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","handleChange","document","getElementById","focus","div","createElement","innerHTML","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","disabledTabs","teacherInstructionsDiv","hidden","visible","classes","renderInstructions","title","subtitle","__html","parsedText","author","state","selectedTab","find","map","renderTab","root","flexContainer","label","handleKeyDown","React","Component","propTypes","PropTypes","object","isRequired","arrayOf","shape","number","string","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,QAAQ,EAAE,CADF;AAERC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAFT;AAGRD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAHC,KADe;AAMzBC,IAAAA,OAAO,EAAE;AACPJ,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADV;AAEPD,MAAAA,KAAK,EAAEA,gBAAME,IAAN,EAFA;AAGPE,MAAAA,OAAO,EAAER,KAAK,CAACS,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KANgB;AAWzBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,QAAQ,EAAE;AADE,KAXW;AAczBC,IAAAA,eAAe,EAAE;AACfD,MAAAA,QAAQ,EAAE;AADK,KAdQ;A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AAiBH,UADP;AAEdP,IAAAA,KAAK,EAAEK,sBAAUM,MAAV,CAAiBJ,UAFV;AAGdnB,IAAAA,KAAK,EAAEiB,sBAAUM,MAAV,CAAiBJ,UAHV;AAIdlB,IAAAA,QAAQ,EAAEgB,sBAAUM,MAJN;AAKdnB,IAAAA,MAAM,EAAEa,sBAAUM,MALJ;AAMdvF,IAAAA,IAAI,EAAEiF,sBAAUM,MAAV,CAAiBJ,UANT;AAOdhE,IAAAA,mBAAmB,EAAE8D,sBAAUM;AAPjB,GAAhB,EAQGJ,UATC,EAUJA,UAZqB;AAavBzB,EAAAA,YAAY,EAAEuB,sBAAUO;AAbD,CAAzB;;eAgBe,wBAAW/F,MAAX,EAAmB+B,YAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapsible, color, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport classNames from 'classnames';\n\nconst styles = (theme) => ({\n passages: {\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n },\n passage: {\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing.unit * 2,\n },\n passageTitle: {\n fontSize: '1.75rem',\n },\n passageSubtitle: {\n fontSize: '1.5rem',\n },\n passageAuthor: {\n fontSize: '1.25rem',\n },\n passageText: {},\n stickyTabs: {\n background: color.background(),\n position: 'sticky',\n top: 0,\n },\n tab: {\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n fontSize: 'inherit',\n color: theme.palette.common.black, // remove when PD-2801 is DONE\n },\n tabButton: {\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n },\n teacherInstructions: {\n marginBottom: theme.spacing.unit * 2,\n },\n});\n\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi, '');\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n };\n\n handleChange = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n this.handleChange(event, tabs[newTabIndex].id);\n document.getElementById(`button-${tabs[newTabIndex].id}`).focus();\n }\n };\n\n parsedText = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = text.replace(/(<br\\/>\\n)/g, '<br/>');\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(teacherInstructions, disabledTabs = false) {\n if (!getContent(teacherInstructions)) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n renderTab(tab, disabledTabs) {\n const { classes } = this.props;\n\n return (\n <div\n className={classNames(classes.passage, 'passage')}\n key={tab.id}\n id={`tabpanel-${tab.id}`}\n role=\"tabpanel\"\n aria-labelledby={`button-${tab.id}`}\n >\n {this.renderInstructions(tab.teacherInstructions, disabledTabs)}\n\n {(getContent(tab.title) || getContent(tab.subtitle)) && (\n <h2>\n {getContent(tab.title) && (\n <div\n className={classNames(classes.passageTitle, 'title')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}\n />\n )}\n {getContent(tab.subtitle) && (\n <div\n className={classNames(classes.passageSubtitle, 'subtitle')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }}\n />\n )}\n </h2>\n )}\n\n {getContent(tab.author) && (\n <div\n className={classNames(classes.passageAuthor, 'author')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }}\n />\n )}\n\n {getContent(tab.text) && (\n <div\n key={tab.id}\n className={classNames(classes.passageText, 'text')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }}\n />\n )}\n </div>\n );\n }\n\n render() {\n const { classes, tabs, disabledTabs } = this.props;\n const { activeTab } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n return (\n <div className={classNames(classes.passages, 'passages')}>\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs))\n ) : (\n <>\n <Tabs\n classes={{\n root: classes.stickyTabs,\n flexContainer: classes.tabButton,\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab) => (\n <Tab\n className={classes.tab}\n key={tab.id}\n id={`button-${tab.id}`}\n label={<span dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }} />}\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={`tabpanel-${tab.id}`}\n aria-selected={activeTab === tab.id}\n onFocus={() => this.handleChange(null, tab.id)}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, disabledTabs) : null}\n </>\n )}\n </div>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n classes: PropTypes.object.isRequired,\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n label: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n};\n\nexport default withStyles(styles)(StimulusTabs);\n"],"file":"stimulus-tabs.js"}
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -1,5 +1,5 @@
1
1
  var defaults = {
2
- teacherInstructionsEnabled: false,
2
+ teacherInstructionsEnabled: true,
3
3
  titleEnabled: true,
4
4
  subtitleEnabled: true,
5
5
  textEnabled: true,
@@ -11,7 +11,7 @@ var defaults = {
11
11
  subtitle: '',
12
12
  author: '',
13
13
  text: '',
14
- }
14
+ },
15
15
  ],
16
16
  };
17
17
 
@@ -19,17 +19,21 @@ const getContent = (html) => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi,
19
19
 
20
20
  function createDefaultModel(model = {}) {
21
21
  return new Promise((resolve) => {
22
- resolve({
23
- ...defaults,
24
- ...model,
25
- });
22
+ resolve({ ...defaults, ...model });
26
23
  });
27
24
  }
28
25
 
29
- const normalize = (question) => ({
30
- ...defaults,
31
- ...question,
32
- });
26
+ const normalize = (question) => ({ ...defaults, ...question });
27
+
28
+ const normalizeTeacherInstructions = (instructions, env) => {
29
+ const { role, mode } = env;
30
+
31
+ if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
32
+ return instructions || '';
33
+ }
34
+
35
+ return '';
36
+ };
33
37
 
34
38
  /**
35
39
  *
@@ -38,21 +42,23 @@ const normalize = (question) => ({
38
42
  * @param {*} env
39
43
  */
40
44
  async function model(question, session, env) {
41
- const { role, mode } = env || {};
42
45
  const normalizedQuestion = normalize(question);
43
46
 
44
- const out = {
47
+ const normalizedPassages = normalizedQuestion.passages.map((passage, index) => ({
48
+ teacherInstructions: normalizedQuestion.teacherInstructionsEnabled
49
+ ? normalizeTeacherInstructions(passage.teacherInstructions, env)
50
+ : '',
51
+ label: passage.titles || `Passage ${index + 1}`,
52
+ title: normalizedQuestion.titleEnabled ? passage.title || '' : '',
53
+ subtitle: normalizedQuestion.subtitleEnabled ? passage.subtitle || '' : '',
54
+ author: normalizedQuestion.authorEnabled ? passage.author || '' : '',
55
+ text: normalizedQuestion.textEnabled ? passage.text || '' : '',
56
+ }));
57
+
58
+ return {
45
59
  ...normalizedQuestion,
46
- teacherInstructions: null
60
+ passages: normalizedPassages,
47
61
  };
48
-
49
- if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
50
- if (normalizedQuestion.teacherInstructionsEnabled) {
51
- out.teacherInstructions = normalizedQuestion.teacherInstructions;
52
- }
53
- }
54
-
55
- return out;
56
62
  }
57
63
 
58
64
  const validate = (model = {}, config = {}) => {
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -8641,6 +8641,7 @@ const styles = theme => ({
8641
8641
  marginBottom: theme.spacing.unit * 2
8642
8642
  }
8643
8643
  });
8644
+ const getContent = html => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi, '');
8644
8645
  class StimulusTabs extends React$1.Component {
8645
8646
  constructor(...args) {
8646
8647
  super(...args);
@@ -8715,8 +8716,8 @@ class StimulusTabs extends React$1.Component {
8715
8716
  return div.innerHTML;
8716
8717
  };
8717
8718
  }
8718
- renderInstructions(showTeacherInstructions, teacherInstructions, disabledTabs = false) {
8719
- if (!showTeacherInstructions || !teacherInstructions) {
8719
+ renderInstructions(teacherInstructions, disabledTabs = false) {
8720
+ if (!getContent(teacherInstructions)) {
8720
8721
  return;
8721
8722
  }
8722
8723
  const teacherInstructionsDiv = React$1.createElement(PreviewPrompt, {
@@ -8727,7 +8728,7 @@ class StimulusTabs extends React$1.Component {
8727
8728
  __self: this,
8728
8729
  __source: {
8729
8730
  fileName: _jsxFileName,
8730
- lineNumber: 140
8731
+ lineNumber: 142
8731
8732
  }
8732
8733
  });
8733
8734
  if (disabledTabs) {
@@ -8741,11 +8742,11 @@ class StimulusTabs extends React$1.Component {
8741
8742
  __self: this,
8742
8743
  __source: {
8743
8744
  fileName: _jsxFileName,
8744
- lineNumber: 153
8745
+ lineNumber: 155
8745
8746
  }
8746
8747
  }, teacherInstructionsDiv);
8747
8748
  }
8748
- renderTab(tab, showTeacherInstructions, disabledTabs) {
8749
+ renderTab(tab, disabledTabs) {
8749
8750
  const {classes} = this.props;
8750
8751
  return React$1.createElement('div', {
8751
8752
  className: classNames(classes.passage, 'passage'),
@@ -8756,15 +8757,15 @@ class StimulusTabs extends React$1.Component {
8756
8757
  __self: this,
8757
8758
  __source: {
8758
8759
  fileName: _jsxFileName,
8759
- lineNumber: 168
8760
+ lineNumber: 170
8760
8761
  }
8761
- }, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement('h2', {
8762
+ }, this.renderInstructions(tab.teacherInstructions, disabledTabs), (getContent(tab.title) || getContent(tab.subtitle)) && React$1.createElement('h2', {
8762
8763
  __self: this,
8763
8764
  __source: {
8764
8765
  fileName: _jsxFileName,
8765
- lineNumber: 176
8766
+ lineNumber: 180
8766
8767
  }
8767
- }, React$1.createElement('div', {
8768
+ }, getContent(tab.title) && React$1.createElement('div', {
8768
8769
  className: classNames(classes.passageTitle, 'title'),
8769
8770
  dangerouslySetInnerHTML: {
8770
8771
  __html: this.parsedText(tab.title)
@@ -8772,9 +8773,9 @@ class StimulusTabs extends React$1.Component {
8772
8773
  __self: this,
8773
8774
  __source: {
8774
8775
  fileName: _jsxFileName,
8775
- lineNumber: 177
8776
+ lineNumber: 182
8776
8777
  }
8777
- }), React$1.createElement('div', {
8778
+ }), getContent(tab.subtitle) && React$1.createElement('div', {
8778
8779
  className: classNames(classes.passageSubtitle, 'subtitle'),
8779
8780
  dangerouslySetInnerHTML: {
8780
8781
  __html: this.parsedText(tab.subtitle)
@@ -8782,9 +8783,9 @@ class StimulusTabs extends React$1.Component {
8782
8783
  __self: this,
8783
8784
  __source: {
8784
8785
  fileName: _jsxFileName,
8785
- lineNumber: 181
8786
+ lineNumber: 188
8786
8787
  }
8787
- })), React$1.createElement('div', {
8788
+ })), getContent(tab.author) && React$1.createElement('div', {
8788
8789
  className: classNames(classes.passageAuthor, 'author'),
8789
8790
  dangerouslySetInnerHTML: {
8790
8791
  __html: this.parsedText(tab.author)
@@ -8792,9 +8793,9 @@ class StimulusTabs extends React$1.Component {
8792
8793
  __self: this,
8793
8794
  __source: {
8794
8795
  fileName: _jsxFileName,
8795
- lineNumber: 186
8796
+ lineNumber: 197
8796
8797
  }
8797
- }), React$1.createElement('div', {
8798
+ }), getContent(tab.text) && React$1.createElement('div', {
8798
8799
  key: tab.id,
8799
8800
  className: classNames(classes.passageText, 'text'),
8800
8801
  dangerouslySetInnerHTML: {
@@ -8803,12 +8804,12 @@ class StimulusTabs extends React$1.Component {
8803
8804
  __self: this,
8804
8805
  __source: {
8805
8806
  fileName: _jsxFileName,
8806
- lineNumber: 190
8807
+ lineNumber: 204
8807
8808
  }
8808
8809
  }));
8809
8810
  }
8810
8811
  render() {
8811
- const {classes, tabs, disabledTabs, showTeacherInstructions} = this.props;
8812
+ const {classes, tabs, disabledTabs} = this.props;
8812
8813
  const {activeTab} = this.state;
8813
8814
  if (!_optionalChain([tabs, 'optionalAccess', _ => _.length])) {
8814
8815
  return;
@@ -8819,9 +8820,9 @@ class StimulusTabs extends React$1.Component {
8819
8820
  __self: this,
8820
8821
  __source: {
8821
8822
  fileName: _jsxFileName,
8822
- lineNumber: 210
8823
+ lineNumber: 225
8823
8824
  }
8824
- }, disabledTabs || tabs.length === 1 ? tabs.map(tab => this.renderTab(tab, showTeacherInstructions, disabledTabs)) : React$1.createElement(React$1.Fragment, null, React$1.createElement(Tabs, {
8825
+ }, disabledTabs || tabs.length === 1 ? tabs.map(tab => this.renderTab(tab, disabledTabs)) : React$1.createElement(React$1.Fragment, null, React$1.createElement(Tabs, {
8825
8826
  classes: {
8826
8827
  root: classes.stickyTabs,
8827
8828
  flexContainer: classes.tabButton
@@ -8831,7 +8832,7 @@ class StimulusTabs extends React$1.Component {
8831
8832
  __self: this,
8832
8833
  __source: {
8833
8834
  fileName: _jsxFileName,
8834
- lineNumber: 215
8835
+ lineNumber: 230
8835
8836
  }
8836
8837
  }, tabs.map(tab => React$1.createElement(Tab, {
8837
8838
  className: classes.tab,
@@ -8839,12 +8840,12 @@ class StimulusTabs extends React$1.Component {
8839
8840
  id: `button-${tab.id}`,
8840
8841
  label: React$1.createElement('span', {
8841
8842
  dangerouslySetInnerHTML: {
8842
- __html: this.parsedText(tab.title)
8843
+ __html: this.parsedText(tab.label)
8843
8844
  },
8844
8845
  __self: this,
8845
8846
  __source: {
8846
8847
  fileName: _jsxFileName,
8847
- lineNumber: 228
8848
+ lineNumber: 243
8848
8849
  }
8849
8850
  }),
8850
8851
  value: tab.id,
@@ -8856,23 +8857,23 @@ class StimulusTabs extends React$1.Component {
8856
8857
  __self: this,
8857
8858
  __source: {
8858
8859
  fileName: _jsxFileName,
8859
- lineNumber: 224
8860
+ lineNumber: 239
8860
8861
  }
8861
- }))), selectedTab ? this.renderTab(selectedTab, showTeacherInstructions, disabledTabs) : null));
8862
+ }))), selectedTab ? this.renderTab(selectedTab, disabledTabs) : null));
8862
8863
  }
8863
8864
  }
8864
8865
  StimulusTabs.propTypes = {
8865
8866
  classes: PropTypes.object.isRequired,
8866
8867
  tabs: PropTypes.arrayOf(PropTypes.shape({
8867
8868
  id: PropTypes.number.isRequired,
8869
+ label: PropTypes.string.isRequired,
8868
8870
  title: PropTypes.string.isRequired,
8869
8871
  subtitle: PropTypes.string,
8870
8872
  author: PropTypes.string,
8871
8873
  text: PropTypes.string.isRequired,
8872
8874
  teacherInstructions: PropTypes.string
8873
8875
  }).isRequired).isRequired,
8874
- disabledTabs: PropTypes.bool,
8875
- showTeacherInstructions: PropTypes.bool
8876
+ disabledTabs: PropTypes.bool
8876
8877
  };
8877
8878
  var StimulusTabs$1 = styles$1.withStyles(styles)(StimulusTabs);
8878
8879
  const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering_accessible;
@@ -8906,19 +8907,14 @@ class PiePassage extends HTMLElement {
8906
8907
  this._render();
8907
8908
  }
8908
8909
  _render() {
8909
- const {passages = [], showTeacherInstructions = false} = this._model;
8910
+ const {passages = []} = this._model;
8910
8911
  if (this._model.passages.length > 0) {
8911
8912
  const passagesTabs = passages.map((passage, index) => ({
8912
8913
  id: index,
8913
- title: passage.title,
8914
- subtitle: passage.subtitle,
8915
- author: passage.author,
8916
- text: passage.text,
8917
- teacherInstructions: passage.teacherInstructions || ''
8914
+ ...passage
8918
8915
  }));
8919
8916
  const elem = React.createElement(StimulusTabs$1, {
8920
- tabs: passagesTabs,
8921
- showTeacherInstructions
8917
+ tabs: passagesTabs
8922
8918
  });
8923
8919
  ReactDOM.render(elem, this, () => renderMath(this));
8924
8920
  }
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/passage@2.21.3</title>
5
+ <title>@pie-element/passage@2.21.4</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,10 +1,10 @@
1
1
  {
2
2
  "name": "@pie-element/passage",
3
- "version": "2.21.3",
3
+ "version": "2.21.4",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.24.1"
7
+ "version": "1.24.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/passage@2.21.3</title>
5
+ <title>@pie-element/passage@2.21.4</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"