@pie-element/passage 2.5.1-next.9 → 2.6.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ # [2.6.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@2.5.0...@pie-element/passage@2.6.0) (2024-03-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * updated pie-lib/pie-toolbox SC-28500 ([a8e4e6a](https://github.com/pie-framework/pie-elements/commit/a8e4e6ab27584435ce7ac3e964ccac2747402777))
12
+ * **passage:** use white background and black text for tabs (temporary fix) PD-3394 ([de0cdfc](https://github.com/pie-framework/pie-elements/commit/de0cdfcb0e0b8779a959cc165e3ca87ec26a289d))
13
+
14
+
15
+ ### Features
16
+
17
+ * updated pie-lib/pie-toolbox SC-27890 and reverted once again math-rendering-accessible ([fd312e1](https://github.com/pie-framework/pie-elements/commit/fd312e1336999893025231946649496d290883e4))
18
+ * use math-rendering-accessible everywhere PD-1870 ([d52e660](https://github.com/pie-framework/pie-elements/commit/d52e6607ad8847d704bd9cb9b7e3107c130f0500))
19
+
20
+
21
+
22
+
23
+
6
24
  # [2.5.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@2.4.2...@pie-element/passage@2.5.0) (2024-03-15)
7
25
 
8
26
 
@@ -47,8 +47,11 @@ var styles = function styles(theme) {
47
47
  color: _renderUi.color.text()
48
48
  },
49
49
  tab: {
50
- backgroundColor: _renderUi.color.background(),
51
- fontSize: 'inherit'
50
+ background: theme.palette.common.white,
51
+ // replace with color.background() once PD-2801 is DONE
52
+ fontSize: 'inherit',
53
+ color: theme.palette.common.black // remove when PD-2801 is DONE
54
+
52
55
  },
53
56
  stickyTabs: {
54
57
  background: _renderUi.color.background(),
@@ -63,7 +66,8 @@ var styles = function styles(theme) {
63
66
  marginBottom: theme.spacing.unit
64
67
  },
65
68
  buttonContainer: {
66
- background: _renderUi.color.background()
69
+ background: theme.palette.common.white // replace with color.background() once PD-2801 is DONE
70
+
67
71
  },
68
72
  tabContainer: {
69
73
  backgroundColor: _renderUi.color.background(),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/stimulus-tabs.jsx"],"names":["styles","theme","root","flexGrow","backgroundColor","color","background","text","tab","fontSize","stickyTabs","position","top","title","textTransform","padding","spacing","unit","borderBottom","secondary","width","marginBottom","buttonContainer","tabContainer","breakSpaces","whiteSpace","teacherInstructions","StimulusTabs","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","window","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","handleChange","div","document","createElement","innerHTML","replace","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","showTeacherInstructions","disabledTabs","teacherInstructionsDiv","hidden","visible","classes","state","map","__html","parsedText","renderInstructions","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,IAAI,EAAE;AACJC,MAAAA,QAAQ,EAAE,CADN;AAEJC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAFb;AAGJD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAHH,KADmB;AAMzBC,IAAAA,GAAG,EAAE;AACHJ,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADd;AAEHG,MAAAA,QAAQ,EAAE;AAFP,KANoB;AAUzBC,IAAAA,UAAU,EAAE;AACVJ,MAAAA,UAAU,EAAED,gBAAMC,UAAN,EADF;AAEVK,MAAAA,QAAQ,EAAE,QAFA;AAGVC,MAAAA,G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ADF;AAQD;AACF;;;EApMwBkE,kBAAMC,S;;AAuMjC/C,YAAY,CAACgD,SAAb,GAAyB;AACvBV,EAAAA,OAAO,EAAEW,sBAAUC,MAAV,CAAiBC,UADH;AAEvBvC,EAAAA,IAAI,EAAEqC,sBAAUG,OAAV,CACJH,sBAAUI,KAAV,CAAgB;AACdpC,IAAAA,EAAE,EAAEgC,sBAAUK,MAAV,CAAiBH,UADP;AAEdjE,IAAAA,KAAK,EAAE+D,sBAAUM,MAAV,CAAiBJ,UAFV;AAGdvE,IAAAA,IAAI,EAAEqE,sBAAUM,MAAV,CAAiBJ,UAHT;AAIdpD,IAAAA,mBAAmB,EAAEkD,sBAAUM;AAJjB,GAAhB,EAKGJ,UANC,EAOJA,UATqB;AAUvBjB,EAAAA,YAAY,EAAEe,sBAAUO,IAVD;AAWvBvB,EAAAA,uBAAuB,EAAEgB,sBAAUO;AAXZ,CAAzB;;eAce,wBAAWnF,MAAX,EAAmB2B,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, Purpose } from '@pie-lib/pie-toolbox/render-ui';\nimport classNames from 'classnames';\n\nconst styles = (theme) => ({\n root: {\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n },\n tab: {\n backgroundColor: color.background(),\n fontSize: 'inherit',\n },\n stickyTabs: {\n background: color.background(),\n position: 'sticky',\n top: 0,\n },\n title: {\n textTransform: 'uppercase',\n padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,\n borderBottom: `2px solid ${color.secondary()}`,\n width: 'fit-content',\n marginBottom: theme.spacing.unit,\n },\n buttonContainer: {\n background: color.background(),\n },\n tabContainer: {\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing.unit * 2,\n },\n breakSpaces: {\n whiteSpace: 'break-spaces',\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 setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: {\n tab: activeTab,\n },\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 case 'ArrowDown':\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n case 'Home':\n newTabIndex = 0;\n break;\n case 'End':\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\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 }\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 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 render() {\n const { classes, tabs, disabledTabs, showTeacherInstructions } = this.props;\n const { activeTab } = this.state;\n\n if (tabs && tabs.length > 1) {\n return disabledTabs ? (\n <div className={classNames(classes.root, 'passages')}>\n {tabs.map((tab) => (\n <div\n key={tab.id}\n className={`passage-${tab.id}`}\n id={`tabpanel-${tab.id}`}\n aria-labelledby={`tab-${tab.id}`}\n aria-controls={`tabpanel-${tab.id}`}\n tabIndex=\"0\"\n >\n <div\n className={classes.tabContainer}\n id={`tabpanel-${tab.id}`}\n role=\"tabpanel\"\n aria-labelledby={`button-${tab.id}`}\n >\n <div\n className={classNames(classes.title, 'title')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}\n />\n {this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs)}\n <Purpose purpose=\"passage-text\">\n <div className=\"text\" key={tab.id} dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }} />\n </Purpose>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className={classNames(classes.root, 'passages')}>\n <Tabs\n classes={{\n root: classes.stickyTabs,\n flexContainer: classes.buttonContainer,\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={\n <Purpose purpose=\"passage-title\">\n <span dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />\n </Purpose>\n }\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\n {tabs.map((tab) =>\n activeTab === tab.id ? (\n <div\n className={classes.tabContainer}\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)}\n\n <Purpose purpose=\"passage-text\">\n <div key={tab.id} dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }} />\n </Purpose>\n </div>\n ) : null,\n )}\n </div>\n );\n } else if (tabs && tabs[0]) {\n return (\n <>\n {this.renderInstructions(showTeacherInstructions, tabs[0].teacherInstructions, disabledTabs)}\n <div className={classNames(classes.root, classes.tabContainer, classes.breakSpaces, 'passage')}>\n <div className=\"text\" dangerouslySetInnerHTML={{ __html: this.parsedText(tabs[0].text) }} />\n </div>\n </>\n );\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 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","root","flexGrow","backgroundColor","color","background","text","tab","palette","common","white","fontSize","black","stickyTabs","position","top","title","textTransform","padding","spacing","unit","borderBottom","secondary","width","marginBottom","buttonContainer","tabContainer","breakSpaces","whiteSpace","teacherInstructions","StimulusTabs","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","window","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","handleChange","div","document","createElement","innerHTML","replace","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","showTeacherInstructions","disabledTabs","teacherInstructionsDiv","hidden","visible","classes","state","map","__html","parsedText","renderInstructions","flexContainer","handleKeyDown","React","Component","propTypes","PropTypes","object","isRequired","arrayOf","shape","number","string","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;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UO;AAXZ,CAAzB;;eAce,wBAAWvF,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, Purpose } from '@pie-lib/pie-toolbox/render-ui';\nimport classNames from 'classnames';\n\nconst styles = (theme) => ({\n root: {\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\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 stickyTabs: {\n background: color.background(),\n position: 'sticky',\n top: 0,\n },\n title: {\n textTransform: 'uppercase',\n padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,\n borderBottom: `2px solid ${color.secondary()}`,\n width: 'fit-content',\n marginBottom: theme.spacing.unit,\n },\n buttonContainer: {\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n },\n tabContainer: {\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing.unit * 2,\n },\n breakSpaces: {\n whiteSpace: 'break-spaces',\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 setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: {\n tab: activeTab,\n },\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 case 'ArrowDown':\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n case 'Home':\n newTabIndex = 0;\n break;\n case 'End':\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\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 }\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 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 render() {\n const { classes, tabs, disabledTabs, showTeacherInstructions } = this.props;\n const { activeTab } = this.state;\n\n if (tabs && tabs.length > 1) {\n return disabledTabs ? (\n <div className={classNames(classes.root, 'passages')}>\n {tabs.map((tab) => (\n <div\n key={tab.id}\n className={`passage-${tab.id}`}\n id={`tabpanel-${tab.id}`}\n aria-labelledby={`tab-${tab.id}`}\n aria-controls={`tabpanel-${tab.id}`}\n tabIndex=\"0\"\n >\n <div\n className={classes.tabContainer}\n id={`tabpanel-${tab.id}`}\n role=\"tabpanel\"\n aria-labelledby={`button-${tab.id}`}\n >\n <div\n className={classNames(classes.title, 'title')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}\n />\n {this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs)}\n <Purpose purpose=\"passage-text\">\n <div className=\"text\" key={tab.id} dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }} />\n </Purpose>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className={classNames(classes.root, 'passages')}>\n <Tabs\n classes={{\n root: classes.stickyTabs,\n flexContainer: classes.buttonContainer,\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={\n <Purpose purpose=\"passage-title\">\n <span dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />\n </Purpose>\n }\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\n {tabs.map((tab) =>\n activeTab === tab.id ? (\n <div\n className={classes.tabContainer}\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)}\n\n <Purpose purpose=\"passage-text\">\n <div key={tab.id} dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }} />\n </Purpose>\n </div>\n ) : null,\n )}\n </div>\n );\n } else if (tabs && tabs[0]) {\n return (\n <>\n {this.renderInstructions(showTeacherInstructions, tabs[0].teacherInstructions, disabledTabs)}\n <div className={classNames(classes.root, classes.tabContainer, classes.breakSpaces, 'passage')}>\n <div className=\"text\" dangerouslySetInnerHTML={{ __html: this.parsedText(tabs[0].text) }} />\n </div>\n </>\n );\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 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"}
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.2.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.4.0/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.0/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) {
@@ -8590,8 +8590,9 @@ const styles = theme => ({
8590
8590
  color: color.text()
8591
8591
  },
8592
8592
  tab: {
8593
- backgroundColor: color.background(),
8594
- fontSize: 'inherit'
8593
+ background: theme.palette.common.white,
8594
+ fontSize: 'inherit',
8595
+ color: theme.palette.common.black
8595
8596
  },
8596
8597
  stickyTabs: {
8597
8598
  background: color.background(),
@@ -8606,7 +8607,7 @@ const styles = theme => ({
8606
8607
  marginBottom: theme.spacing.unit
8607
8608
  },
8608
8609
  buttonContainer: {
8609
- background: color.background()
8610
+ background: theme.palette.common.white
8610
8611
  },
8611
8612
  tabContainer: {
8612
8613
  backgroundColor: color.background(),
@@ -8707,7 +8708,7 @@ class StimulusTabs extends React$1.Component {
8707
8708
  __self: this,
8708
8709
  __source: {
8709
8710
  fileName: _jsxFileName,
8710
- lineNumber: 126
8711
+ lineNumber: 127
8711
8712
  }
8712
8713
  });
8713
8714
  if (disabledTabs) {
@@ -8721,7 +8722,7 @@ class StimulusTabs extends React$1.Component {
8721
8722
  __self: this,
8722
8723
  __source: {
8723
8724
  fileName: _jsxFileName,
8724
- lineNumber: 139
8725
+ lineNumber: 140
8725
8726
  }
8726
8727
  }, teacherInstructionsDiv);
8727
8728
  }
@@ -8734,7 +8735,7 @@ class StimulusTabs extends React$1.Component {
8734
8735
  __self: this,
8735
8736
  __source: {
8736
8737
  fileName: _jsxFileName,
8737
- lineNumber: 156
8738
+ lineNumber: 157
8738
8739
  }
8739
8740
  }, tabs.map(tab => React$1.createElement('div', {
8740
8741
  key: tab.id,
@@ -8746,7 +8747,7 @@ class StimulusTabs extends React$1.Component {
8746
8747
  __self: this,
8747
8748
  __source: {
8748
8749
  fileName: _jsxFileName,
8749
- lineNumber: 158
8750
+ lineNumber: 159
8750
8751
  }
8751
8752
  }, React$1.createElement('div', {
8752
8753
  className: classes.tabContainer,
@@ -8756,7 +8757,7 @@ class StimulusTabs extends React$1.Component {
8756
8757
  __self: this,
8757
8758
  __source: {
8758
8759
  fileName: _jsxFileName,
8759
- lineNumber: 166
8760
+ lineNumber: 167
8760
8761
  }
8761
8762
  }, React$1.createElement('div', {
8762
8763
  className: classNames(classes.title, 'title'),
@@ -8766,14 +8767,14 @@ class StimulusTabs extends React$1.Component {
8766
8767
  __self: this,
8767
8768
  __source: {
8768
8769
  fileName: _jsxFileName,
8769
- lineNumber: 172
8770
+ lineNumber: 173
8770
8771
  }
8771
8772
  }), this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement(Purpose, {
8772
8773
  purpose: "passage-text",
8773
8774
  __self: this,
8774
8775
  __source: {
8775
8776
  fileName: _jsxFileName,
8776
- lineNumber: 177
8777
+ lineNumber: 178
8777
8778
  }
8778
8779
  }, React$1.createElement('div', {
8779
8780
  className: "text",
@@ -8784,14 +8785,14 @@ class StimulusTabs extends React$1.Component {
8784
8785
  __self: this,
8785
8786
  __source: {
8786
8787
  fileName: _jsxFileName,
8787
- lineNumber: 178
8788
+ lineNumber: 179
8788
8789
  }
8789
8790
  })))))) : React$1.createElement('div', {
8790
8791
  className: classNames(classes.root, 'passages'),
8791
8792
  __self: this,
8792
8793
  __source: {
8793
8794
  fileName: _jsxFileName,
8794
- lineNumber: 185
8795
+ lineNumber: 186
8795
8796
  }
8796
8797
  }, React$1.createElement(Tabs, {
8797
8798
  classes: {
@@ -8803,7 +8804,7 @@ class StimulusTabs extends React$1.Component {
8803
8804
  __self: this,
8804
8805
  __source: {
8805
8806
  fileName: _jsxFileName,
8806
- lineNumber: 186
8807
+ lineNumber: 187
8807
8808
  }
8808
8809
  }, tabs.map(tab => React$1.createElement(Tab, {
8809
8810
  className: classes.tab,
@@ -8814,7 +8815,7 @@ class StimulusTabs extends React$1.Component {
8814
8815
  __self: this,
8815
8816
  __source: {
8816
8817
  fileName: _jsxFileName,
8817
- lineNumber: 200
8818
+ lineNumber: 201
8818
8819
  }
8819
8820
  }, React$1.createElement('span', {
8820
8821
  dangerouslySetInnerHTML: {
@@ -8823,7 +8824,7 @@ class StimulusTabs extends React$1.Component {
8823
8824
  __self: this,
8824
8825
  __source: {
8825
8826
  fileName: _jsxFileName,
8826
- lineNumber: 201
8827
+ lineNumber: 202
8827
8828
  }
8828
8829
  })),
8829
8830
  value: tab.id,
@@ -8835,7 +8836,7 @@ class StimulusTabs extends React$1.Component {
8835
8836
  __self: this,
8836
8837
  __source: {
8837
8838
  fileName: _jsxFileName,
8838
- lineNumber: 195
8839
+ lineNumber: 196
8839
8840
  }
8840
8841
  }))), tabs.map(tab => activeTab === tab.id ? React$1.createElement('div', {
8841
8842
  className: classes.tabContainer,
@@ -8846,14 +8847,14 @@ class StimulusTabs extends React$1.Component {
8846
8847
  __self: this,
8847
8848
  __source: {
8848
8849
  fileName: _jsxFileName,
8849
- lineNumber: 216
8850
+ lineNumber: 217
8850
8851
  }
8851
8852
  }, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions), React$1.createElement(Purpose, {
8852
8853
  purpose: "passage-text",
8853
8854
  __self: this,
8854
8855
  __source: {
8855
8856
  fileName: _jsxFileName,
8856
- lineNumber: 225
8857
+ lineNumber: 226
8857
8858
  }
8858
8859
  }, React$1.createElement('div', {
8859
8860
  key: tab.id,
@@ -8863,7 +8864,7 @@ class StimulusTabs extends React$1.Component {
8863
8864
  __self: this,
8864
8865
  __source: {
8865
8866
  fileName: _jsxFileName,
8866
- lineNumber: 226
8867
+ lineNumber: 227
8867
8868
  }
8868
8869
  }))) : null));
8869
8870
  } else if (tabs && tabs[0]) {
@@ -8872,7 +8873,7 @@ class StimulusTabs extends React$1.Component {
8872
8873
  __self: this,
8873
8874
  __source: {
8874
8875
  fileName: _jsxFileName,
8875
- lineNumber: 237
8876
+ lineNumber: 238
8876
8877
  }
8877
8878
  }, React$1.createElement('div', {
8878
8879
  className: "text",
@@ -8882,7 +8883,7 @@ class StimulusTabs extends React$1.Component {
8882
8883
  __self: this,
8883
8884
  __source: {
8884
8885
  fileName: _jsxFileName,
8885
- lineNumber: 238
8886
+ lineNumber: 239
8886
8887
  }
8887
8888
  })));
8888
8889
  }
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.5.0</title>
5
+ <title>@pie-element/passage@2.6.0</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.5.0",
3
+ "version": "2.6.0",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.2.0"
7
+ "version": "1.4.0"
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.5.0</title>
5
+ <title>@pie-element/passage@2.6.0</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,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.2.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.4.0/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.0/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) {
@@ -8553,8 +8553,9 @@ const styles = theme => ({
8553
8553
  color: color.text()
8554
8554
  },
8555
8555
  tab: {
8556
- backgroundColor: color.background(),
8557
- fontSize: 'inherit'
8556
+ background: theme.palette.common.white,
8557
+ fontSize: 'inherit',
8558
+ color: theme.palette.common.black
8558
8559
  },
8559
8560
  stickyTabs: {
8560
8561
  background: color.background(),
@@ -8569,7 +8570,7 @@ const styles = theme => ({
8569
8570
  marginBottom: theme.spacing.unit
8570
8571
  },
8571
8572
  buttonContainer: {
8572
- background: color.background()
8573
+ background: theme.palette.common.white
8573
8574
  },
8574
8575
  tabContainer: {
8575
8576
  backgroundColor: color.background(),
@@ -8670,7 +8671,7 @@ class StimulusTabs extends React$1.Component {
8670
8671
  __self: this,
8671
8672
  __source: {
8672
8673
  fileName: _jsxFileName,
8673
- lineNumber: 126
8674
+ lineNumber: 127
8674
8675
  }
8675
8676
  });
8676
8677
  if (disabledTabs) {
@@ -8684,7 +8685,7 @@ class StimulusTabs extends React$1.Component {
8684
8685
  __self: this,
8685
8686
  __source: {
8686
8687
  fileName: _jsxFileName,
8687
- lineNumber: 139
8688
+ lineNumber: 140
8688
8689
  }
8689
8690
  }, teacherInstructionsDiv);
8690
8691
  }
@@ -8697,7 +8698,7 @@ class StimulusTabs extends React$1.Component {
8697
8698
  __self: this,
8698
8699
  __source: {
8699
8700
  fileName: _jsxFileName,
8700
- lineNumber: 156
8701
+ lineNumber: 157
8701
8702
  }
8702
8703
  }, tabs.map(tab => React$1.createElement('div', {
8703
8704
  key: tab.id,
@@ -8709,7 +8710,7 @@ class StimulusTabs extends React$1.Component {
8709
8710
  __self: this,
8710
8711
  __source: {
8711
8712
  fileName: _jsxFileName,
8712
- lineNumber: 158
8713
+ lineNumber: 159
8713
8714
  }
8714
8715
  }, React$1.createElement('div', {
8715
8716
  className: classes.tabContainer,
@@ -8719,7 +8720,7 @@ class StimulusTabs extends React$1.Component {
8719
8720
  __self: this,
8720
8721
  __source: {
8721
8722
  fileName: _jsxFileName,
8722
- lineNumber: 166
8723
+ lineNumber: 167
8723
8724
  }
8724
8725
  }, React$1.createElement('div', {
8725
8726
  className: classNames(classes.title, 'title'),
@@ -8729,14 +8730,14 @@ class StimulusTabs extends React$1.Component {
8729
8730
  __self: this,
8730
8731
  __source: {
8731
8732
  fileName: _jsxFileName,
8732
- lineNumber: 172
8733
+ lineNumber: 173
8733
8734
  }
8734
8735
  }), this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement(Purpose, {
8735
8736
  purpose: "passage-text",
8736
8737
  __self: this,
8737
8738
  __source: {
8738
8739
  fileName: _jsxFileName,
8739
- lineNumber: 177
8740
+ lineNumber: 178
8740
8741
  }
8741
8742
  }, React$1.createElement('div', {
8742
8743
  className: "text",
@@ -8747,14 +8748,14 @@ class StimulusTabs extends React$1.Component {
8747
8748
  __self: this,
8748
8749
  __source: {
8749
8750
  fileName: _jsxFileName,
8750
- lineNumber: 178
8751
+ lineNumber: 179
8751
8752
  }
8752
8753
  })))))) : React$1.createElement('div', {
8753
8754
  className: classNames(classes.root, 'passages'),
8754
8755
  __self: this,
8755
8756
  __source: {
8756
8757
  fileName: _jsxFileName,
8757
- lineNumber: 185
8758
+ lineNumber: 186
8758
8759
  }
8759
8760
  }, React$1.createElement(Tabs, {
8760
8761
  classes: {
@@ -8766,7 +8767,7 @@ class StimulusTabs extends React$1.Component {
8766
8767
  __self: this,
8767
8768
  __source: {
8768
8769
  fileName: _jsxFileName,
8769
- lineNumber: 186
8770
+ lineNumber: 187
8770
8771
  }
8771
8772
  }, tabs.map(tab => React$1.createElement(Tab, {
8772
8773
  className: classes.tab,
@@ -8777,7 +8778,7 @@ class StimulusTabs extends React$1.Component {
8777
8778
  __self: this,
8778
8779
  __source: {
8779
8780
  fileName: _jsxFileName,
8780
- lineNumber: 200
8781
+ lineNumber: 201
8781
8782
  }
8782
8783
  }, React$1.createElement('span', {
8783
8784
  dangerouslySetInnerHTML: {
@@ -8786,7 +8787,7 @@ class StimulusTabs extends React$1.Component {
8786
8787
  __self: this,
8787
8788
  __source: {
8788
8789
  fileName: _jsxFileName,
8789
- lineNumber: 201
8790
+ lineNumber: 202
8790
8791
  }
8791
8792
  })),
8792
8793
  value: tab.id,
@@ -8798,7 +8799,7 @@ class StimulusTabs extends React$1.Component {
8798
8799
  __self: this,
8799
8800
  __source: {
8800
8801
  fileName: _jsxFileName,
8801
- lineNumber: 195
8802
+ lineNumber: 196
8802
8803
  }
8803
8804
  }))), tabs.map(tab => activeTab === tab.id ? React$1.createElement('div', {
8804
8805
  className: classes.tabContainer,
@@ -8809,14 +8810,14 @@ class StimulusTabs extends React$1.Component {
8809
8810
  __self: this,
8810
8811
  __source: {
8811
8812
  fileName: _jsxFileName,
8812
- lineNumber: 216
8813
+ lineNumber: 217
8813
8814
  }
8814
8815
  }, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions), React$1.createElement(Purpose, {
8815
8816
  purpose: "passage-text",
8816
8817
  __self: this,
8817
8818
  __source: {
8818
8819
  fileName: _jsxFileName,
8819
- lineNumber: 225
8820
+ lineNumber: 226
8820
8821
  }
8821
8822
  }, React$1.createElement('div', {
8822
8823
  key: tab.id,
@@ -8826,7 +8827,7 @@ class StimulusTabs extends React$1.Component {
8826
8827
  __self: this,
8827
8828
  __source: {
8828
8829
  fileName: _jsxFileName,
8829
- lineNumber: 226
8830
+ lineNumber: 227
8830
8831
  }
8831
8832
  }))) : null));
8832
8833
  } else if (tabs && tabs[0]) {
@@ -8835,7 +8836,7 @@ class StimulusTabs extends React$1.Component {
8835
8836
  __self: this,
8836
8837
  __source: {
8837
8838
  fileName: _jsxFileName,
8838
- lineNumber: 237
8839
+ lineNumber: 238
8839
8840
  }
8840
8841
  }, React$1.createElement('div', {
8841
8842
  className: "text",
@@ -8845,7 +8846,7 @@ class StimulusTabs extends React$1.Component {
8845
8846
  __self: this,
8846
8847
  __source: {
8847
8848
  fileName: _jsxFileName,
8848
- lineNumber: 238
8849
+ lineNumber: 239
8849
8850
  }
8850
8851
  })));
8851
8852
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/passage",
3
- "version": "2.5.1-next.9+c3f6156ab",
3
+ "version": "2.6.1-next.0+0260e08e8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,13 +11,13 @@
11
11
  "dependencies": {
12
12
  "@material-ui/core": "^3.9.2",
13
13
  "@pie-framework/pie-player-events": "^0.1.0",
14
- "@pie-lib/pie-toolbox": "1.10.0",
14
+ "@pie-lib/pie-toolbox": "1.11.1",
15
15
  "classnames": "^2.2.5",
16
16
  "prop-types": "^15.6.1",
17
17
  "react": "^16.8.1",
18
18
  "react-dom": "^16.8.1"
19
19
  },
20
- "gitHead": "c3f6156abbc3d45042d5b8ebeb96372055360ed8",
20
+ "gitHead": "0260e08e86e6b0683fd07acecbca0703c6dc54df",
21
21
  "scripts": {
22
22
  "postpublish": "../../scripts/postpublish"
23
23
  },