@pie-lib/correct-answer-toggle 2.25.3-next.162 → 2.25.3-next.165
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/lib/expander.js +1 -0
- package/lib/expander.js.map +1 -1
- package/lib/index.js +10 -2
- package/lib/index.js.map +1 -1
- package/package.json +5 -13
- package/src/expander.jsx +4 -2
- package/src/index.jsx +17 -15
- package/esm/package.json +0 -3
package/lib/expander.js
CHANGED
package/lib/expander.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expander.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_styles","_reactTransitionGroup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","transition","StyledExpander","styled","position","height","overflow","display","visibility","width","opacity","minHeight","Expander","props","show","children","className","nodeRef","useRef","createElement","CSSTransition","appear","mountOnEnter","timeout","classNames","enter","enterDone","exit","exitDone","propTypes","PropTypes","bool","isRequired","string","oneOfType","arrayOf","node","_default","exports"],"sources":["../src/expander.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { CSSTransition } from 'react-transition-group';\n\nconst transition = 'height ease-in 300ms, opacity ease-in 300ms';\n\nconst StyledExpander = styled('div')(() => ({\n position: 'relative',\n height: 0,\n overflow: 'hidden',\n display: 'flex',\n visibility: 'hidden',\n width: 0,\n '&.enter': {\n transition,\n opacity: 1,\n height: 'auto',\n width: 'auto',\n visibility: 'visible',\n minHeight: '25px',\n },\n '&.enter-done': {\n height: 'auto',\n visibility: 'visible',\n width: 'auto',\n minHeight: '25px',\n },\n '&.exit': {\n transition,\n opacity: 0,\n height: 0,\n visibility: 'visible',\n width: 0,\n },\n '&.exit-done': {\n opacity: 0,\n visibility: 'hidden',\n height: 0,\n width: 0,\n },\n}));\n\nconst Expander = (props) => {\n const { show, children, className } = props;\n const nodeRef = useRef(null);\n\n return (\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n appear={true}\n mountOnEnter={false}\n timeout={300}\n classNames={{\n enter: 'enter',\n enterDone: 'enter-done',\n exit: 'exit',\n exitDone: 'exit-done'
|
|
1
|
+
{"version":3,"file":"expander.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_styles","_reactTransitionGroup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","transition","StyledExpander","styled","position","height","overflow","display","visibility","width","opacity","minHeight","Expander","props","show","children","className","nodeRef","useRef","createElement","CSSTransition","appear","mountOnEnter","timeout","classNames","enter","enterDone","exit","exitDone","ref","propTypes","PropTypes","bool","isRequired","string","oneOfType","arrayOf","node","_default","exports"],"sources":["../src/expander.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { CSSTransition } from 'react-transition-group';\n\nconst transition = 'height ease-in 300ms, opacity ease-in 300ms';\n\nconst StyledExpander = styled('div')(() => ({\n position: 'relative',\n height: 0,\n overflow: 'hidden',\n display: 'flex',\n visibility: 'hidden',\n width: 0,\n '&.enter': {\n transition,\n opacity: 1,\n height: 'auto',\n width: 'auto',\n visibility: 'visible',\n minHeight: '25px',\n },\n '&.enter-done': {\n height: 'auto',\n visibility: 'visible',\n width: 'auto',\n minHeight: '25px',\n },\n '&.exit': {\n transition,\n opacity: 0,\n height: 0,\n visibility: 'visible',\n width: 0,\n },\n '&.exit-done': {\n opacity: 0,\n visibility: 'hidden',\n height: 0,\n width: 0,\n },\n}));\n\nconst Expander = (props) => {\n const { show, children, className } = props;\n const nodeRef = useRef(null);\n\n return (\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n appear={true}\n mountOnEnter={false}\n timeout={300}\n classNames={{\n enter: 'enter',\n enterDone: 'enter-done',\n exit: 'exit',\n exitDone: 'exit-done',\n }}\n >\n <StyledExpander ref={nodeRef} className={className}>\n {children}\n </StyledExpander>\n </CSSTransition>\n );\n};\n\nExpander.propTypes = {\n show: PropTypes.bool.isRequired,\n className: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n};\n\nexport default Expander;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAJ,OAAA;AAAuD,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,wBAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAnB,CAAA,EAAAc,EAAA,OAAAP,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA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5B,oBACE5C,MAAA,YAAA6C,aAAA,CAACvC,qBAAA,CAAAwC,aAAa;IACZH,OAAO,EAAEA,OAAQ;IACjB,MAAIH,IAAK;IACTO,MAAM,EAAE,IAAK;IACbC,YAAY,EAAE,KAAM;IACpBC,OAAO,EAAE,GAAI;IACbC,UAAU,EAAE;MACVC,KAAK,EAAE,OAAO;MACdC,SAAS,EAAE,YAAY;MACvBC,IAAI,EAAE,MAAM;MACZC,QAAQ,EAAE;IACZ;EAAE,gBAEFtD,MAAA,YAAA6C,aAAA,CAACjB,cAAc;IAAC2B,GAAG,EAAEZ,OAAQ;IAACD,SAAS,EAAEA;EAAU,GAChDD,QACa,CACH,CAAC;AAEpB,CAAC;AAEDH,QAAQ,CAACkB,SAAS,GAAG;EACnBhB,IAAI,EAAEiB,qBAAS,CAACC,IAAI,CAACC,UAAU;EAC/BjB,SAAS,EAAEe,qBAAS,CAACG,MAAM;EAC3BnB,QAAQ,EAAEgB,qBAAS,CAACI,SAAS,CAAC,CAACJ,qBAAS,CAACK,OAAO,CAACL,qBAAS,CAACM,IAAI,CAAC,EAAEN,qBAAS,CAACM,IAAI,CAAC,CAAC,CAACJ;AACrF,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEa3B,QAAQ","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -95,6 +95,8 @@ var CorrectAnswerToggle = exports.CorrectAnswerToggle = /*#__PURE__*/function (_
|
|
|
95
95
|
_this.state = {
|
|
96
96
|
show: props.show
|
|
97
97
|
};
|
|
98
|
+
_this.openIconRef = /*#__PURE__*/_react["default"].createRef();
|
|
99
|
+
_this.closedIconRef = /*#__PURE__*/_react["default"].createRef();
|
|
98
100
|
CorrectAnswerToggle.defaultProps = _objectSpread(_objectSpread({}, CorrectAnswerToggle.defaultProps), {}, {
|
|
99
101
|
showMessage: translator.t('common:showCorrectAnswer', {
|
|
100
102
|
lng: props.language
|
|
@@ -151,6 +153,7 @@ var CorrectAnswerToggle = exports.CorrectAnswerToggle = /*#__PURE__*/function (_
|
|
|
151
153
|
onClick: this.onClick.bind(this),
|
|
152
154
|
onTouchEnd: this.onTouch.bind(this)
|
|
153
155
|
}, /*#__PURE__*/_react["default"].createElement(StyledIconHolder, null, /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
|
|
156
|
+
nodeRef: this.openIconRef,
|
|
154
157
|
timeout: 400,
|
|
155
158
|
"in": toggled,
|
|
156
159
|
exit: !toggled,
|
|
@@ -160,10 +163,13 @@ var CorrectAnswerToggle = exports.CorrectAnswerToggle = /*#__PURE__*/function (_
|
|
|
160
163
|
exit: 'exit',
|
|
161
164
|
exitActive: 'exit-active'
|
|
162
165
|
}
|
|
163
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledIcon,
|
|
166
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledIcon, {
|
|
167
|
+
ref: this.openIconRef
|
|
168
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
|
|
164
169
|
open: toggled,
|
|
165
170
|
key: "correct-open"
|
|
166
171
|
}))), /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
|
|
172
|
+
nodeRef: this.closedIconRef,
|
|
167
173
|
timeout: 5000,
|
|
168
174
|
"in": !toggled,
|
|
169
175
|
exit: toggled,
|
|
@@ -173,7 +179,9 @@ var CorrectAnswerToggle = exports.CorrectAnswerToggle = /*#__PURE__*/function (_
|
|
|
173
179
|
exit: 'exit',
|
|
174
180
|
exitActive: 'exit-active'
|
|
175
181
|
}
|
|
176
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledIcon,
|
|
182
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledIcon, {
|
|
183
|
+
ref: this.closedIconRef
|
|
184
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
|
|
177
185
|
open: toggled,
|
|
178
186
|
key: "correct-closed"
|
|
179
187
|
})))), /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_styles","require","_reactTransitionGroup","_icons","_renderUi","_expander","_interopRequireDefault","_react","_propTypes","_translator","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","ownKeys","r","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","translator","Translator","noTouch","StyledRoot","styled","width","cursor","StyledContent","margin","textAlign","display","StyledLabel","minWidth","alignSelf","verticalAlign","color","concat","text","fontWeight","StyledIcon","position","opacity","transition","StyledIconHolder","marginRight","alignItems","CorrectAnswerToggle","exports","_React$Component","props","_this","_classCallCheck2","state","show","defaultProps","showMessage","lng","language","hideMessage","_inherits2","_createClass2","key","value","onClick","onToggle","toggled","onTouch","event","preventDefault","UNSAFE_componentWillReceiveProps","nextProps","_this$props","setState","render","_this$props2","className","createElement","bind","onTouchEnd","CSSTransition","timeout","exit","classNames","enter","enterActive","exitActive","CorrectResponse","open","Readable","React","Component","PropTypes","func","bool","string","_default"],"sources":["../src/index.jsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport { CSSTransition } from 'react-transition-group';\nimport { CorrectResponse } from '@pie-lib/icons';\nimport { Readable } from '@pie-lib/render-ui';\nimport Expander from './expander';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport Translator from '@pie-lib/translator';\nimport { color } from '@pie-lib/render-ui';\n\nconst { translator } = Translator;\n\nconst noTouch = {\n '-webkit-touchCcallout': 'none',\n '-webkit-user-select': 'none',\n '-khtml-user-select': 'none',\n '-moz-user-select': 'none',\n '-ms-user-select': 'none',\n 'user-select': 'none',\n};\n\nconst StyledRoot = styled('div')(() => ({\n width: '100%',\n cursor: 'pointer',\n}));\n\nconst StyledContent = styled('div')(() => ({\n margin: '0 auto',\n textAlign: 'center',\n display: 'flex',\n}));\n\nconst StyledLabel = styled('div')(() => ({\n width: 'fit-content',\n minWidth: '140px',\n alignSelf: 'center',\n verticalAlign: 'middle',\n color: `var(--correct-answer-toggle-label-color, ${color.text()})`,\n fontWeight: 'normal',\n ...noTouch,\n}));\n\nconst StyledIcon = styled('div')(() => ({\n position: 'absolute',\n width: '25px',\n '&.enter': {\n opacity: '0',\n },\n '&.enter-active': {\n opacity: '1',\n transition: 'opacity 0.3s ease-in',\n },\n '&.exit': {\n opacity: '1',\n },\n '&.exit-active': {\n opacity: '0',\n transition: 'opacity 0.3s ease-in',\n },\n}));\n\nconst StyledIconHolder = styled('div')(() => ({\n width: '25px',\n marginRight: '5px',\n display: 'flex',\n alignItems: 'center',\n}));\n\n/**\n * We export the raw unstyled class for testability. For public use please use the default export.\n */\nexport class CorrectAnswerToggle extends React.Component {\n static propTypes = {\n onToggle: PropTypes.func,\n toggled: PropTypes.bool,\n show: PropTypes.bool,\n hideMessage: PropTypes.string,\n showMessage: PropTypes.string,\n className: PropTypes.string,\n language: PropTypes.string,\n };\n\n static defaultProps = {\n showMessage: 'Show correct answer',\n hideMessage: 'Hide correct answer',\n show: false,\n toggled: false,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n show: props.show,\n };\n\n CorrectAnswerToggle.defaultProps = {\n ...CorrectAnswerToggle.defaultProps,\n showMessage: translator.t('common:showCorrectAnswer', { lng: props.language }),\n hideMessage: translator.t('common:hideCorrectAnswer', { lng: props.language }),\n };\n }\n\n onClick() {\n this.props.onToggle(!this.props.toggled);\n }\n onTouch(event) {\n event.preventDefault(); // Prevents the default action (click event)\n this.props.onToggle(!this.props.toggled);\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.setState({\n show: nextProps.show,\n });\n\n if (nextProps.language !== this.props?.language) {\n CorrectAnswerToggle.defaultProps = {\n ...CorrectAnswerToggle.defaultProps,\n showMessage: translator.t('common:showCorrectAnswer', { lng: nextProps.language }),\n hideMessage: translator.t('common:hideCorrectAnswer', { lng: nextProps.language }),\n };\n }\n }\n\n render() {\n const { className, toggled, hideMessage, showMessage } = this.props;\n\n return (\n <StyledRoot className={className}>\n <Expander show={this.state.show}>\n <StyledContent onClick={this.onClick.bind(this)} onTouchEnd={this.onTouch.bind(this)}>\n <StyledIconHolder>\n <CSSTransition \n timeout={400} \n in={toggled} \n exit={!toggled} \n classNames={{\n enter: 'enter',\n enterActive: 'enter-active',\n exit: 'exit',\n exitActive: 'exit-active'\n }}\n >\n <StyledIcon>\n <CorrectResponse open={toggled} key=\"correct-open\" />\n </StyledIcon>\n </CSSTransition>\n <CSSTransition \n timeout={5000} \n in={!toggled} \n exit={toggled} \n classNames={{\n enter: 'enter',\n enterActive: 'enter-active',\n exit: 'exit',\n exitActive: 'exit-active'\n }}\n >\n <StyledIcon>\n <CorrectResponse open={toggled} key=\"correct-closed\" />\n </StyledIcon>\n </CSSTransition>\n </StyledIconHolder>\n <Readable false>\n <StyledLabel aria-hidden={!this.state.show}>\n {toggled ? hideMessage : showMessage}\n </StyledLabel>\n </Readable>\n </StyledContent>\n </Expander>\n </StyledRoot>\n );\n }\n}\n\nexport default CorrectAnswerToggle;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,UAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,WAAA,GAAAH,sBAAA,CAAAL,OAAA;AAA6C,SAAAS,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,EAAAK,yBAAA,KAAAC,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AC;MAAK,gBACbvG,MAAA,YAAA2F,aAAA,CAAC7C,WAAW;QAAC,eAAa,CAAC,IAAI,CAACqB,KAAK,CAACC;MAAK,GACxCY,OAAO,GAAGP,WAAW,GAAGH,WACd,CACL,CACG,CACP,CACA,CAAC;IAEjB;EAAC;AAAA,EArGsCkC,iBAAK,CAACC,SAAS;AAAA,IAAA1E,gBAAA,aAA3C8B,mBAAmB,eACX;EACjBkB,QAAQ,EAAE2B,qBAAS,CAACC,IAAI;EACxB3B,OAAO,EAAE0B,qBAAS,CAACE,IAAI;EACvBxC,IAAI,EAAEsC,qBAAS,CAACE,IAAI;EACpBnC,WAAW,EAAEiC,qBAAS,CAACG,MAAM;EAC7BvC,WAAW,EAAEoC,qBAAS,CAACG,MAAM;EAC7BnB,SAAS,EAAEgB,qBAAS,CAACG,MAAM;EAC3BrC,QAAQ,EAAEkC,qBAAS,CAACG;AACtB,CAAC;AAAA,IAAA9E,gBAAA,aATU8B,mBAAmB,kBAWR;EACpBS,WAAW,EAAE,qBAAqB;EAClCG,WAAW,EAAE,qBAAqB;EAClCL,IAAI,EAAE,KAAK;EACXY,OAAO,EAAE;AACX,CAAC;AAAA,IAAA8B,QAAA,GAAAhD,OAAA,cAwFYD,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_styles","require","_reactTransitionGroup","_icons","_renderUi","_expander","_interopRequireDefault","_react","_propTypes","_translator","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","ownKeys","r","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","translator","Translator","noTouch","StyledRoot","styled","width","cursor","StyledContent","margin","textAlign","display","StyledLabel","minWidth","alignSelf","verticalAlign","color","concat","text","fontWeight","StyledIcon","position","opacity","transition","StyledIconHolder","marginRight","alignItems","CorrectAnswerToggle","exports","_React$Component","props","_this","_classCallCheck2","state","show","openIconRef","React","createRef","closedIconRef","defaultProps","showMessage","lng","language","hideMessage","_inherits2","_createClass2","key","value","onClick","onToggle","toggled","onTouch","event","preventDefault","UNSAFE_componentWillReceiveProps","nextProps","_this$props","setState","render","_this$props2","className","createElement","bind","onTouchEnd","CSSTransition","nodeRef","timeout","exit","classNames","enter","enterActive","exitActive","ref","CorrectResponse","open","Readable","Component","PropTypes","func","bool","string","_default"],"sources":["../src/index.jsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport { CSSTransition } from 'react-transition-group';\nimport { CorrectResponse } from '@pie-lib/icons';\nimport { Readable } from '@pie-lib/render-ui';\nimport Expander from './expander';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport Translator from '@pie-lib/translator';\nimport { color } from '@pie-lib/render-ui';\n\nconst { translator } = Translator;\n\nconst noTouch = {\n '-webkit-touchCcallout': 'none',\n '-webkit-user-select': 'none',\n '-khtml-user-select': 'none',\n '-moz-user-select': 'none',\n '-ms-user-select': 'none',\n 'user-select': 'none',\n};\n\nconst StyledRoot = styled('div')(() => ({\n width: '100%',\n cursor: 'pointer',\n}));\n\nconst StyledContent = styled('div')(() => ({\n margin: '0 auto',\n textAlign: 'center',\n display: 'flex',\n}));\n\nconst StyledLabel = styled('div')(() => ({\n width: 'fit-content',\n minWidth: '140px',\n alignSelf: 'center',\n verticalAlign: 'middle',\n color: `var(--correct-answer-toggle-label-color, ${color.text()})`,\n fontWeight: 'normal',\n ...noTouch,\n}));\n\nconst StyledIcon = styled('div')(() => ({\n position: 'absolute',\n width: '25px',\n '&.enter': {\n opacity: '0',\n },\n '&.enter-active': {\n opacity: '1',\n transition: 'opacity 0.3s ease-in',\n },\n '&.exit': {\n opacity: '1',\n },\n '&.exit-active': {\n opacity: '0',\n transition: 'opacity 0.3s ease-in',\n },\n}));\n\nconst StyledIconHolder = styled('div')(() => ({\n width: '25px',\n marginRight: '5px',\n display: 'flex',\n alignItems: 'center',\n}));\n\n/**\n * We export the raw unstyled class for testability. For public use please use the default export.\n */\nexport class CorrectAnswerToggle extends React.Component {\n static propTypes = {\n onToggle: PropTypes.func,\n toggled: PropTypes.bool,\n show: PropTypes.bool,\n hideMessage: PropTypes.string,\n showMessage: PropTypes.string,\n className: PropTypes.string,\n language: PropTypes.string,\n };\n\n static defaultProps = {\n showMessage: 'Show correct answer',\n hideMessage: 'Hide correct answer',\n show: false,\n toggled: false,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n show: props.show,\n };\n this.openIconRef = React.createRef();\n this.closedIconRef = React.createRef();\n\n CorrectAnswerToggle.defaultProps = {\n ...CorrectAnswerToggle.defaultProps,\n showMessage: translator.t('common:showCorrectAnswer', { lng: props.language }),\n hideMessage: translator.t('common:hideCorrectAnswer', { lng: props.language }),\n };\n }\n\n onClick() {\n this.props.onToggle(!this.props.toggled);\n }\n onTouch(event) {\n event.preventDefault(); // Prevents the default action (click event)\n this.props.onToggle(!this.props.toggled);\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.setState({\n show: nextProps.show,\n });\n\n if (nextProps.language !== this.props?.language) {\n CorrectAnswerToggle.defaultProps = {\n ...CorrectAnswerToggle.defaultProps,\n showMessage: translator.t('common:showCorrectAnswer', { lng: nextProps.language }),\n hideMessage: translator.t('common:hideCorrectAnswer', { lng: nextProps.language }),\n };\n }\n }\n\n render() {\n const { className, toggled, hideMessage, showMessage } = this.props;\n\n return (\n <StyledRoot className={className}>\n <Expander show={this.state.show}>\n <StyledContent onClick={this.onClick.bind(this)} onTouchEnd={this.onTouch.bind(this)}>\n <StyledIconHolder>\n <CSSTransition\n nodeRef={this.openIconRef}\n timeout={400}\n in={toggled}\n exit={!toggled}\n classNames={{\n enter: 'enter',\n enterActive: 'enter-active',\n exit: 'exit',\n exitActive: 'exit-active',\n }}\n >\n <StyledIcon ref={this.openIconRef}>\n <CorrectResponse open={toggled} key=\"correct-open\" />\n </StyledIcon>\n </CSSTransition>\n <CSSTransition\n nodeRef={this.closedIconRef}\n timeout={5000}\n in={!toggled}\n exit={toggled}\n classNames={{\n enter: 'enter',\n enterActive: 'enter-active',\n exit: 'exit',\n exitActive: 'exit-active',\n }}\n >\n <StyledIcon ref={this.closedIconRef}>\n <CorrectResponse open={toggled} key=\"correct-closed\" />\n </StyledIcon>\n </CSSTransition>\n </StyledIconHolder>\n <Readable false>\n <StyledLabel aria-hidden={!this.state.show}>{toggled ? hideMessage : showMessage}</StyledLabel>\n </Readable>\n </StyledContent>\n </Expander>\n </StyledRoot>\n );\n }\n}\n\nexport default CorrectAnswerToggle;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,UAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,WAAA,GAAAH,sBAAA,CAAAL,OAAA;AAA6C,SAAAS,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,EAAAK,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAG,0BAAA,cAAAL,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAK,yBAAA,YAAAA,0BAAA,aAAAL,CAAA;AAAA,SAAAc,QAAAZ,CAAA,EAAAa,CAA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AAC,IAAI,CAACqB,KAAK,CAACC;MAAK,GAAEgB,OAAO,GAAGP,WAAW,GAAGH,WAAyB,CACtF,CACG,CACP,CACA,CAAC;IAEjB;EAAC;AAAA,EAvGsCJ,iBAAK,CAACwC,SAAS;AAAA,IAAA/E,gBAAA,aAA3C8B,mBAAmB,eACX;EACjBsB,QAAQ,EAAE4B,qBAAS,CAACC,IAAI;EACxB5B,OAAO,EAAE2B,qBAAS,CAACE,IAAI;EACvB7C,IAAI,EAAE2C,qBAAS,CAACE,IAAI;EACpBpC,WAAW,EAAEkC,qBAAS,CAACG,MAAM;EAC7BxC,WAAW,EAAEqC,qBAAS,CAACG,MAAM;EAC7BpB,SAAS,EAAEiB,qBAAS,CAACG,MAAM;EAC3BtC,QAAQ,EAAEmC,qBAAS,CAACG;AACtB,CAAC;AAAA,IAAAnF,gBAAA,aATU8B,mBAAmB,kBAWR;EACpBa,WAAW,EAAE,qBAAqB;EAClCG,WAAW,EAAE,qBAAqB;EAClCT,IAAI,EAAE,KAAK;EACXgB,OAAO,EAAE;AACX,CAAC;AAAA,IAAA+B,QAAA,GAAArD,OAAA,cA0FYD,mBAAmB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"version": "2.25.3-next.
|
|
15
|
+
"version": "2.25.3-next.165+4f4c5f4c",
|
|
16
16
|
"main": "lib/index.js",
|
|
17
17
|
"module": "src/index.jsx",
|
|
18
18
|
"scripts": {},
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@emotion/style": "^0.8.0",
|
|
22
22
|
"@mui/icons-material": "^7.3.4",
|
|
23
23
|
"@mui/material": "^7.3.4",
|
|
24
|
-
"@pie-lib/icons": "2.24.
|
|
25
|
-
"@pie-lib/render-ui": "4.35.
|
|
26
|
-
"@pie-lib/translator": "2.23.
|
|
24
|
+
"@pie-lib/icons": "2.24.3-next.0",
|
|
25
|
+
"@pie-lib/render-ui": "4.35.4-next.0",
|
|
26
|
+
"@pie-lib/translator": "2.23.3-next.0",
|
|
27
27
|
"lodash": "^4.17.11",
|
|
28
28
|
"prop-types": "^15.6.2",
|
|
29
29
|
"react-transition-group": "^4.4.5"
|
|
@@ -36,13 +36,5 @@
|
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"react-dom": "^18.2.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
-
"exports": {
|
|
41
|
-
".": {
|
|
42
|
-
"require": "./lib/index.js",
|
|
43
|
-
"import": "./src/index.jsx",
|
|
44
|
-
"default": "./lib/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./esm": "./esm/index.js"
|
|
47
|
-
}
|
|
39
|
+
"gitHead": "4f4c5f4c5f12f6763f9d2c49ee77529aa70371b8"
|
|
48
40
|
}
|
package/src/expander.jsx
CHANGED
|
@@ -56,10 +56,12 @@ const Expander = (props) => {
|
|
|
56
56
|
enter: 'enter',
|
|
57
57
|
enterDone: 'enter-done',
|
|
58
58
|
exit: 'exit',
|
|
59
|
-
exitDone: 'exit-done'
|
|
59
|
+
exitDone: 'exit-done',
|
|
60
60
|
}}
|
|
61
61
|
>
|
|
62
|
-
<StyledExpander className={className}>
|
|
62
|
+
<StyledExpander ref={nodeRef} className={className}>
|
|
63
|
+
{children}
|
|
64
|
+
</StyledExpander>
|
|
63
65
|
</CSSTransition>
|
|
64
66
|
);
|
|
65
67
|
};
|
package/src/index.jsx
CHANGED
|
@@ -92,6 +92,8 @@ export class CorrectAnswerToggle extends React.Component {
|
|
|
92
92
|
this.state = {
|
|
93
93
|
show: props.show,
|
|
94
94
|
};
|
|
95
|
+
this.openIconRef = React.createRef();
|
|
96
|
+
this.closedIconRef = React.createRef();
|
|
95
97
|
|
|
96
98
|
CorrectAnswerToggle.defaultProps = {
|
|
97
99
|
...CorrectAnswerToggle.defaultProps,
|
|
@@ -130,41 +132,41 @@ export class CorrectAnswerToggle extends React.Component {
|
|
|
130
132
|
<Expander show={this.state.show}>
|
|
131
133
|
<StyledContent onClick={this.onClick.bind(this)} onTouchEnd={this.onTouch.bind(this)}>
|
|
132
134
|
<StyledIconHolder>
|
|
133
|
-
<CSSTransition
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
<CSSTransition
|
|
136
|
+
nodeRef={this.openIconRef}
|
|
137
|
+
timeout={400}
|
|
138
|
+
in={toggled}
|
|
139
|
+
exit={!toggled}
|
|
137
140
|
classNames={{
|
|
138
141
|
enter: 'enter',
|
|
139
142
|
enterActive: 'enter-active',
|
|
140
143
|
exit: 'exit',
|
|
141
|
-
exitActive: 'exit-active'
|
|
144
|
+
exitActive: 'exit-active',
|
|
142
145
|
}}
|
|
143
146
|
>
|
|
144
|
-
<StyledIcon>
|
|
147
|
+
<StyledIcon ref={this.openIconRef}>
|
|
145
148
|
<CorrectResponse open={toggled} key="correct-open" />
|
|
146
149
|
</StyledIcon>
|
|
147
150
|
</CSSTransition>
|
|
148
|
-
<CSSTransition
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
<CSSTransition
|
|
152
|
+
nodeRef={this.closedIconRef}
|
|
153
|
+
timeout={5000}
|
|
154
|
+
in={!toggled}
|
|
155
|
+
exit={toggled}
|
|
152
156
|
classNames={{
|
|
153
157
|
enter: 'enter',
|
|
154
158
|
enterActive: 'enter-active',
|
|
155
159
|
exit: 'exit',
|
|
156
|
-
exitActive: 'exit-active'
|
|
160
|
+
exitActive: 'exit-active',
|
|
157
161
|
}}
|
|
158
162
|
>
|
|
159
|
-
<StyledIcon>
|
|
163
|
+
<StyledIcon ref={this.closedIconRef}>
|
|
160
164
|
<CorrectResponse open={toggled} key="correct-closed" />
|
|
161
165
|
</StyledIcon>
|
|
162
166
|
</CSSTransition>
|
|
163
167
|
</StyledIconHolder>
|
|
164
168
|
<Readable false>
|
|
165
|
-
<StyledLabel aria-hidden={!this.state.show}>
|
|
166
|
-
{toggled ? hideMessage : showMessage}
|
|
167
|
-
</StyledLabel>
|
|
169
|
+
<StyledLabel aria-hidden={!this.state.show}>{toggled ? hideMessage : showMessage}</StyledLabel>
|
|
168
170
|
</Readable>
|
|
169
171
|
</StyledContent>
|
|
170
172
|
</Expander>
|
package/esm/package.json
DELETED