@pie-lib/correct-answer-toggle 2.25.1 → 2.26.0-mui-update.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,7 +3,7 @@
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.25.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.2...@pie-lib/correct-answer-toggle@2.25.1) (2025-10-22)
6
+ # [2.26.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.25.0-mui-update.0...@pie-lib/correct-answer-toggle@2.26.0-mui-update.0) (2025-11-05)
7
7
 
8
8
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- # [2.25.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.24.0...@pie-lib/correct-answer-toggle@2.25.0) (2025-10-16)
14
+ # [2.25.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.24.0-mui-update.0...@pie-lib/correct-answer-toggle@2.25.0-mui-update.0) (2025-11-03)
15
15
 
16
16
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
17
17
 
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- # [2.24.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.0...@pie-lib/correct-answer-toggle@2.24.0) (2025-10-16)
22
+ # [2.24.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.22.0-mui-update.0...@pie-lib/correct-answer-toggle@2.24.0-mui-update.0) (2025-11-03)
23
23
 
24
24
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
25
25
 
@@ -27,17 +27,18 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
27
27
 
28
28
 
29
29
 
30
- # [2.23.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.0...@pie-lib/correct-answer-toggle@2.23.0) (2025-10-16)
31
-
32
- **Note:** Version bump only for package @pie-lib/correct-answer-toggle
30
+ # [2.22.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.2...@pie-lib/correct-answer-toggle@2.22.0-mui-update.0) (2025-10-31)
33
31
 
34
32
 
33
+ ### Bug Fixes
35
34
 
35
+ * **correct-answer-toggle, text-select:** change logic to corresp to material v5 PD-5269 PD-5271 ([e992861](https://github.com/pie-framework/pie-lib/commit/e992861c6d964340bf7afc8e5ac9007816d510ef))
36
36
 
37
37
 
38
- # [2.22.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.0...@pie-lib/correct-answer-toggle@2.22.0) (2025-10-16)
38
+ ### Features
39
39
 
40
- **Note:** Version bump only for package @pie-lib/correct-answer-toggle
40
+ * **correct-answe-toggle, legend:** delete unused files and imports PD-5258 ([261638d](https://github.com/pie-framework/pie-lib/commit/261638d9ceff79163eb858696a4c8eb7a7a3006c))
41
+ * bump react and react-dom ([01dc19e](https://github.com/pie-framework/pie-lib/commit/01dc19e88bbc8d372c561d1511df1a82937d45af))
41
42
 
42
43
 
43
44
 
package/lib/expander.js CHANGED
@@ -1,60 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
8
  var _react = _interopRequireDefault(require("react"));
13
-
14
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
- var _styles = require("@material-ui/core/styles");
17
-
10
+ var _styles = require("@mui/material/styles");
18
11
  var _reactTransitionGroup = require("react-transition-group");
19
-
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
-
24
- var Expander = function Expander(props) {
25
- var classes = props.classes,
26
- show = props.show,
27
- children = props.children;
28
- return /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
29
- "in": show,
30
- appear: true,
31
- mountOnEnter: false,
32
- timeout: 300,
33
- classNames: _objectSpread({}, classes)
34
- }, /*#__PURE__*/_react["default"].createElement("div", {
35
- className: classes.expander
36
- }, children));
37
- };
38
-
39
- Expander.propTypes = {
40
- show: _propTypes["default"].bool.isRequired,
41
- className: _propTypes["default"].string,
42
- classes: _propTypes["default"].object,
43
- children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
44
- };
45
12
  var transition = 'height ease-in 300ms, opacity ease-in 300ms';
46
-
47
- var _default = (0, _styles.withStyles)(function () {
13
+ var StyledExpander = (0, _styles.styled)('div')(function () {
48
14
  return {
49
- expander: {
50
- position: 'relative',
51
- height: 0,
52
- overflow: 'hidden',
53
- display: 'flex',
54
- visibility: 'hidden',
55
- width: 0
56
- },
57
- enter: {
15
+ position: 'relative',
16
+ height: 0,
17
+ overflow: 'hidden',
18
+ display: 'flex',
19
+ visibility: 'hidden',
20
+ width: 0,
21
+ '&.enter': {
58
22
  transition: transition,
59
23
  opacity: 1,
60
24
  height: 'auto',
@@ -62,27 +26,50 @@ var _default = (0, _styles.withStyles)(function () {
62
26
  visibility: 'visible',
63
27
  minHeight: '25px'
64
28
  },
65
- enterDone: {
29
+ '&.enter-done': {
66
30
  height: 'auto',
67
31
  visibility: 'visible',
68
32
  width: 'auto',
69
33
  minHeight: '25px'
70
34
  },
71
- exit: {
35
+ '&.exit': {
72
36
  transition: transition,
73
37
  opacity: 0,
74
38
  height: 0,
75
39
  visibility: 'visible',
76
40
  width: 0
77
41
  },
78
- exitDone: {
42
+ '&.exit-done': {
79
43
  opacity: 0,
80
44
  visibility: 'hidden',
81
45
  height: 0,
82
46
  width: 0
83
47
  }
84
48
  };
85
- })(Expander);
86
-
87
- exports["default"] = _default;
49
+ });
50
+ var Expander = function Expander(props) {
51
+ var show = props.show,
52
+ children = props.children,
53
+ className = props.className;
54
+ return /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
55
+ "in": show,
56
+ appear: true,
57
+ mountOnEnter: false,
58
+ timeout: 300,
59
+ classNames: {
60
+ enter: 'enter',
61
+ enterDone: 'enter-done',
62
+ exit: 'exit',
63
+ exitDone: 'exit-done'
64
+ }
65
+ }, /*#__PURE__*/_react["default"].createElement(StyledExpander, {
66
+ className: className
67
+ }, children));
68
+ };
69
+ Expander.propTypes = {
70
+ show: _propTypes["default"].bool.isRequired,
71
+ className: _propTypes["default"].string,
72
+ children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
73
+ };
74
+ var _default = exports["default"] = Expander;
88
75
  //# sourceMappingURL=expander.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/expander.jsx"],"names":["Expander","props","classes","show","children","expander","propTypes","PropTypes","bool","isRequired","className","string","object","oneOfType","arrayOf","node","transition","position","height","overflow","display","visibility","width","enter","opacity","minHeight","enterDone","exit","exitDone"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAW;AAC1B,MAAQC,OAAR,GAAoCD,KAApC,CAAQC,OAAR;AAAA,MAAiBC,IAAjB,GAAoCF,KAApC,CAAiBE,IAAjB;AAAA,MAAuBC,QAAvB,GAAoCH,KAApC,CAAuBG,QAAvB;AAEA,sBACE,gCAAC,mCAAD;AAAe,UAAID,IAAnB;AAAyB,IAAA,MAAM,EAAE,IAAjC;AAAuC,IAAA,YAAY,EAAE,KAArD;AAA4D,IAAA,OAAO,EAAE,GAArE;AAA0E,IAAA,UAAU,oBAAOD,OAAP;AAApF,kBACE;AAAK,IAAA,SAAS,EAAEA,OAAO,CAACG;AAAxB,KAAmCD,QAAnC,CADF,CADF;AAKD,CARD;;AAUAJ,QAAQ,CAACM,SAAT,GAAqB;AACnBH,EAAAA,IAAI,EAAEI,sBAAUC,IAAV,CAAeC,UADF;AAEnBC,EAAAA,SAAS,EAAEH,sBAAUI,MAFF;AAGnBT,EAAAA,OAAO,EAAEK,sBAAUK,MAHA;AAInBR,EAAAA,QAAQ,EAAEG,sBAAUM,SAAV,CAAoB,CAACN,sBAAUO,OAAV,CAAkBP,sBAAUQ,IAA5B,CAAD,EAAoCR,sBAAUQ,IAA9C,CAApB,EAAyEN;AAJhE,CAArB;AAOA,IAAMO,UAAU,GAAG,6CAAnB;;eAEe,wBAAW;AAAA,SAAO;AAC/BX,IAAAA,QAAQ,EAAE;AACRY,MAAAA,QAAQ,EAAE,UADF;AAERC,MAAAA,MAAM,EAAE,CAFA;AAGRC,MAAAA,QAAQ,EAAE,QAHF;AAIRC,MAAAA,OAAO,EAAE,MAJD;AAKRC,MAAAA,UAAU,EAAE,QALJ;AAMRC,MAAAA,KAAK,EAAE;AANC,KADqB;AAS/BC,IAAAA,KAAK,EAAE;AACLP,MAAAA,UAAU,EAAVA,UADK;AAELQ,MAAAA,OAAO,EAAE,CAFJ;AAGLN,MAAAA,MAAM,EAAE,MAHH;AAILI,MAAAA,KAAK,EAAE,MAJF;AAKLD,MAAAA,UAAU,EAAE,SALP;AAMLI,MAAAA,SAAS,EAAE;AANN,KATwB;AAiB/BC,IAAAA,SAAS,EAAE;AACTR,MAAAA,MAAM,EAAE,MADC;AAETG,MAAAA,UAAU,EAAE,SAFH;AAGTC,MAAAA,KAAK,EAAE,MAHE;AAITG,MAAAA,SAAS,EAAE;AAJF,KAjBoB;AAuB/BE,IAAAA,IAAI,EAAE;AACJX,MAAAA,UAAU,EAAVA,UADI;AAEJQ,MAAAA,OAAO,EAAE,CAFL;AAGJN,MAAAA,MAAM,EAAE,CAHJ;AAIJG,MAAAA,UAAU,EAAE,SAJR;AAKJC,MAAAA,KAAK,EAAE;AALH,KAvByB;AA8B/BM,IAAAA,QAAQ,EAAE;AACRJ,MAAAA,OAAO,EAAE,CADD;AAERH,MAAAA,UAAU,EAAE,QAFJ;AAGRH,MAAAA,MAAM,EAAE,CAHA;AAIRI,MAAAA,KAAK,EAAE;AAJC;AA9BqB,GAAP;AAAA,CAAX,EAoCXtB,QApCW,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { CSSTransition } from 'react-transition-group';\n\nconst Expander = (props) => {\n const { classes, show, children } = props;\n\n return (\n <CSSTransition in={show} appear={true} mountOnEnter={false} timeout={300} classNames={{ ...classes }}>\n <div className={classes.expander}>{children}</div>\n </CSSTransition>\n );\n};\n\nExpander.propTypes = {\n show: PropTypes.bool.isRequired,\n className: PropTypes.string,\n classes: PropTypes.object,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n};\n\nconst transition = 'height ease-in 300ms, opacity ease-in 300ms';\n\nexport default withStyles(() => ({\n expander: {\n position: 'relative',\n height: 0,\n overflow: 'hidden',\n display: 'flex',\n visibility: 'hidden',\n width: 0,\n },\n enter: {\n transition,\n opacity: 1,\n height: 'auto',\n width: 'auto',\n visibility: 'visible',\n minHeight: '25px',\n },\n enterDone: {\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 exitDone: {\n opacity: 0,\n visibility: 'hidden',\n height: 0,\n width: 0,\n },\n}))(Expander);\n"],"file":"expander.js"}
1
+ {"version":3,"file":"expander.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_reactTransitionGroup","transition","StyledExpander","styled","position","height","overflow","display","visibility","width","opacity","minHeight","Expander","props","show","children","className","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 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\n return (\n <CSSTransition \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 className={className}>{children}</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,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAMI,UAAU,GAAG,6CAA6C;AAEhE,IAAMC,cAAc,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAAA,OAAO;IAC1CC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,QAAQ,EAAE,QAAQ;IAClBC,OAAO,EAAE,MAAM;IACfC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,CAAC;IACR,SAAS,EAAE;MACTR,UAAU,EAAVA,UAAU;MACVS,OAAO,EAAE,CAAC;MACVL,MAAM,EAAE,MAAM;MACdI,KAAK,EAAE,MAAM;MACbD,UAAU,EAAE,SAAS;MACrBG,SAAS,EAAE;IACb,CAAC;IACD,cAAc,EAAE;MACdN,MAAM,EAAE,MAAM;MACdG,UAAU,EAAE,SAAS;MACrBC,KAAK,EAAE,MAAM;MACbE,SAAS,EAAE;IACb,CAAC;IACD,QAAQ,EAAE;MACRV,UAAU,EAAVA,UAAU;MACVS,OAAO,EAAE,CAAC;MACVL,MAAM,EAAE,CAAC;MACTG,UAAU,EAAE,SAAS;MACrBC,KAAK,EAAE;IACT,CAAC;IACD,aAAa,EAAE;MACbC,OAAO,EAAE,CAAC;MACVF,UAAU,EAAE,QAAQ;MACpBH,MAAM,EAAE,CAAC;MACTI,KAAK,EAAE;IACT;EACF,CAAC;AAAA,CAAC,CAAC;AAEH,IAAMG,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,KAAK,EAAK;EAC1B,IAAQC,IAAI,GAA0BD,KAAK,CAAnCC,IAAI;IAAEC,QAAQ,GAAgBF,KAAK,CAA7BE,QAAQ;IAAEC,SAAS,GAAKH,KAAK,CAAnBG,SAAS;EAEjC,oBACErB,MAAA,YAAAsB,aAAA,CAACjB,qBAAA,CAAAkB,aAAa;IACZ,MAAIJ,IAAK;IACTK,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,gBAEF/B,MAAA,YAAAsB,aAAA,CAACf,cAAc;IAACc,SAAS,EAAEA;EAAU,GAAED,QAAyB,CACnD,CAAC;AAEpB,CAAC;AAEDH,QAAQ,CAACe,SAAS,GAAG;EACnBb,IAAI,EAAEc,qBAAS,CAACC,IAAI,CAACC,UAAU;EAC/Bd,SAAS,EAAEY,qBAAS,CAACG,MAAM;EAC3BhB,QAAQ,EAAEa,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,cAEaxB,QAAQ","ignoreList":[]}
package/lib/index.js CHANGED
@@ -1,67 +1,97 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = exports.CorrectAnswerToggle = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
-
16
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
-
18
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
-
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
20
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
-
22
- var _styles = _interopRequireDefault(require("./styles"));
23
-
24
- var _styles2 = require("@material-ui/core/styles");
25
-
14
+ var _styles = require("@mui/material/styles");
26
15
  var _CSSTransition = _interopRequireDefault(require("react-transition-group/CSSTransition"));
27
-
28
16
  var _icons = require("@pie-lib/icons");
29
-
30
17
  var _renderUi = require("@pie-lib/render-ui");
31
-
32
18
  var _expander = _interopRequireDefault(require("./expander"));
33
-
34
19
  var _react = _interopRequireDefault(require("react"));
35
-
36
- var _classnames = _interopRequireDefault(require("classnames"));
37
-
38
20
  var _propTypes = _interopRequireDefault(require("prop-types"));
39
-
40
21
  var _translator = _interopRequireDefault(require("@pie-lib/translator"));
41
-
42
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
43
-
44
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
45
-
46
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
47
-
48
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
49
-
22
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
23
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
50
26
  var translator = _translator["default"].translator;
27
+ var noTouch = {
28
+ '-webkit-touchCcallout': 'none',
29
+ '-webkit-user-select': 'none',
30
+ '-khtml-user-select': 'none',
31
+ '-moz-user-select': 'none',
32
+ '-ms-user-select': 'none',
33
+ 'user-select': 'none'
34
+ };
35
+ var StyledRoot = (0, _styles.styled)('div')(function () {
36
+ return {
37
+ width: '100%',
38
+ cursor: 'pointer'
39
+ };
40
+ });
41
+ var StyledContent = (0, _styles.styled)('div')(function () {
42
+ return {
43
+ margin: '0 auto',
44
+ textAlign: 'center',
45
+ display: 'flex'
46
+ };
47
+ });
48
+ var StyledLabel = (0, _styles.styled)('div')(function () {
49
+ return _objectSpread({
50
+ width: 'fit-content',
51
+ minWidth: '140px',
52
+ alignSelf: 'center',
53
+ verticalAlign: 'middle',
54
+ color: "var(--correct-answer-toggle-label-color, ".concat(_renderUi.color.text(), ")"),
55
+ fontWeight: 'normal'
56
+ }, noTouch);
57
+ });
58
+ var StyledIcon = (0, _styles.styled)('div')(function () {
59
+ return {
60
+ position: 'absolute',
61
+ width: '25px',
62
+ '&.enter': {
63
+ opacity: '0'
64
+ },
65
+ '&.enter-active': {
66
+ opacity: '1',
67
+ transition: 'opacity 0.3s ease-in'
68
+ },
69
+ '&.exit': {
70
+ opacity: '1'
71
+ },
72
+ '&.exit-active': {
73
+ opacity: '0',
74
+ transition: 'opacity 0.3s ease-in'
75
+ }
76
+ };
77
+ });
78
+ var StyledIconHolder = (0, _styles.styled)('div')(function () {
79
+ return {
80
+ width: '25px',
81
+ marginRight: '5px',
82
+ display: 'flex',
83
+ alignItems: 'center'
84
+ };
85
+ });
86
+
51
87
  /**
52
88
  * We export the raw unstyled class for testability. For public use please use the default export.
53
89
  */
54
-
55
- var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
56
- (0, _inherits2["default"])(CorrectAnswerToggle, _React$Component);
57
-
58
- var _super = _createSuper(CorrectAnswerToggle);
59
-
90
+ var CorrectAnswerToggle = exports.CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
60
91
  function CorrectAnswerToggle(props) {
61
92
  var _this;
62
-
63
93
  (0, _classCallCheck2["default"])(this, CorrectAnswerToggle);
64
- _this = _super.call(this, props);
94
+ _this = _callSuper(this, CorrectAnswerToggle, [props]);
65
95
  _this.state = {
66
96
  show: props.show
67
97
  };
@@ -75,8 +105,8 @@ var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
75
105
  });
76
106
  return _this;
77
107
  }
78
-
79
- (0, _createClass2["default"])(CorrectAnswerToggle, [{
108
+ (0, _inherits2["default"])(CorrectAnswerToggle, _React$Component);
109
+ return (0, _createClass2["default"])(CorrectAnswerToggle, [{
80
110
  key: "onClick",
81
111
  value: function onClick() {
82
112
  this.props.onToggle(!this.props.toggled);
@@ -85,18 +115,15 @@ var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
85
115
  key: "onTouch",
86
116
  value: function onTouch(event) {
87
117
  event.preventDefault(); // Prevents the default action (click event)
88
-
89
118
  this.props.onToggle(!this.props.toggled);
90
119
  }
91
120
  }, {
92
121
  key: "UNSAFE_componentWillReceiveProps",
93
122
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
94
123
  var _this$props;
95
-
96
124
  this.setState({
97
125
  show: nextProps.show
98
126
  });
99
-
100
127
  if (nextProps.language !== ((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.language)) {
101
128
  CorrectAnswerToggle.defaultProps = _objectSpread(_objectSpread({}, CorrectAnswerToggle.defaultProps), {}, {
102
129
  showMessage: translator.t('common:showCorrectAnswer', {
@@ -112,59 +139,57 @@ var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
112
139
  key: "render",
113
140
  value: function render() {
114
141
  var _this$props2 = this.props,
115
- classes = _this$props2.classes,
116
- className = _this$props2.className,
117
- toggled = _this$props2.toggled,
118
- hideMessage = _this$props2.hideMessage,
119
- showMessage = _this$props2.showMessage;
120
- return /*#__PURE__*/_react["default"].createElement("div", {
121
- className: (0, _classnames["default"])(classes.root, className)
142
+ className = _this$props2.className,
143
+ toggled = _this$props2.toggled,
144
+ hideMessage = _this$props2.hideMessage,
145
+ showMessage = _this$props2.showMessage;
146
+ return /*#__PURE__*/_react["default"].createElement(StyledRoot, {
147
+ className: className
122
148
  }, /*#__PURE__*/_react["default"].createElement(_expander["default"], {
123
- show: this.state.show,
124
- className: classes.expander
125
- }, /*#__PURE__*/_react["default"].createElement("div", {
126
- className: classes.content,
149
+ show: this.state.show
150
+ }, /*#__PURE__*/_react["default"].createElement(StyledContent, {
127
151
  onClick: this.onClick.bind(this),
128
152
  onTouchEnd: this.onTouch.bind(this)
129
- }, /*#__PURE__*/_react["default"].createElement("div", {
130
- className: classes.iconHolder
131
- }, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
153
+ }, /*#__PURE__*/_react["default"].createElement(StyledIconHolder, null, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
132
154
  timeout: 400,
133
155
  "in": toggled,
134
156
  exit: !toggled,
135
- classNames: classes
136
- }, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
157
+ classNames: {
158
+ enter: 'enter',
159
+ enterActive: 'enter-active',
160
+ exit: 'exit',
161
+ exitActive: 'exit-active'
162
+ }
163
+ }, /*#__PURE__*/_react["default"].createElement(StyledIcon, null, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
137
164
  open: toggled,
138
- key: "correct-open",
139
- className: classes.icon
140
- })), /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
165
+ key: "correct-open"
166
+ }))), /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
141
167
  timeout: 5000,
142
168
  "in": !toggled,
143
169
  exit: toggled,
144
- classNames: classes
145
- }, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
170
+ classNames: {
171
+ enter: 'enter',
172
+ enterActive: 'enter-active',
173
+ exit: 'exit',
174
+ exitActive: 'exit-active'
175
+ }
176
+ }, /*#__PURE__*/_react["default"].createElement(StyledIcon, null, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
146
177
  open: toggled,
147
- key: "correct-closed",
148
- className: classes.icon
149
- }))), /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
178
+ key: "correct-closed"
179
+ })))), /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
150
180
  "false": true
151
- }, /*#__PURE__*/_react["default"].createElement("div", {
152
- className: classes.label,
181
+ }, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
153
182
  "aria-hidden": !this.state.show
154
183
  }, toggled ? hideMessage : showMessage)))));
155
184
  }
156
185
  }]);
157
- return CorrectAnswerToggle;
158
186
  }(_react["default"].Component);
159
-
160
- exports.CorrectAnswerToggle = CorrectAnswerToggle;
161
187
  (0, _defineProperty2["default"])(CorrectAnswerToggle, "propTypes", {
162
188
  onToggle: _propTypes["default"].func,
163
189
  toggled: _propTypes["default"].bool,
164
190
  show: _propTypes["default"].bool,
165
191
  hideMessage: _propTypes["default"].string,
166
192
  showMessage: _propTypes["default"].string,
167
- classes: _propTypes["default"].object.isRequired,
168
193
  className: _propTypes["default"].string,
169
194
  language: _propTypes["default"].string
170
195
  });
@@ -174,8 +199,5 @@ exports.CorrectAnswerToggle = CorrectAnswerToggle;
174
199
  show: false,
175
200
  toggled: false
176
201
  });
177
-
178
- var _default = (0, _styles2.withStyles)(_styles["default"])(CorrectAnswerToggle);
179
-
180
- exports["default"] = _default;
202
+ var _default = exports["default"] = CorrectAnswerToggle;
181
203
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.jsx"],"names":["translator","Translator","CorrectAnswerToggle","props","state","show","defaultProps","showMessage","t","lng","language","hideMessage","onToggle","toggled","event","preventDefault","nextProps","setState","classes","className","root","expander","content","onClick","bind","onTouch","iconHolder","icon","label","React","Component","PropTypes","func","bool","string","object","isRequired","styles"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;AAEA;AACA;AACA;;IACaE,mB;;;;;AAmBX,+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K,OAAO,CAACS;AAAxE,QADF,CAJF,CADF,eASE,gCAAC,kBAAD;AAAU;AAAV,sBACE;AAAK,QAAA,SAAS,EAAET,OAAO,CAACU,KAAxB;AAA+B,uBAAa,CAAC,KAAKxB,KAAL,CAAWC;AAAxD,SACGQ,OAAO,GAAGF,WAAH,GAAiBJ,WAD3B,CADF,CATF,CADF,CADF,CADF;AAqBD;;;EA9EsCsB,kBAAMC,S;;;iCAAlC5B,mB,eACQ;AACjBU,EAAAA,QAAQ,EAAEmB,sBAAUC,IADH;AAEjBnB,EAAAA,OAAO,EAAEkB,sBAAUE,IAFF;AAGjB5B,EAAAA,IAAI,EAAE0B,sBAAUE,IAHC;AAIjBtB,EAAAA,WAAW,EAAEoB,sBAAUG,MAJN;AAKjB3B,EAAAA,WAAW,EAAEwB,sBAAUG,MALN;AAMjBhB,EAAAA,OAAO,EAAEa,sBAAUI,MAAV,CAAiBC,UANT;AAOjBjB,EAAAA,SAAS,EAAEY,sBAAUG,MAPJ;AAQjBxB,EAAAA,QAAQ,EAAEqB,sBAAUG;AARH,C;iCADRhC,mB,kBAYW;AACpBK,EAAAA,WAAW,EAAE,qBADO;AAEpBI,EAAAA,WAAW,EAAE,qBAFO;AAGpBN,EAAAA,IAAI,EAAE,KAHc;AAIpBQ,EAAAA,OAAO,EAAE;AAJW,C;;eAqET,yBAAWwB,kBAAX,EAAmBnC,mBAAnB,C","sourcesContent":["import styles from './styles';\nimport { withStyles } from '@material-ui/core/styles';\nimport CSSTransition from 'react-transition-group/CSSTransition';\nimport { CorrectResponse } from '@pie-lib/icons';\nimport { Readable } from '@pie-lib/render-ui';\nimport Expander from './expander';\nimport React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\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 classes: PropTypes.object.isRequired,\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 { classes, className, toggled, hideMessage, showMessage } = this.props;\n\n return (\n <div className={classNames(classes.root, className)}>\n <Expander show={this.state.show} className={classes.expander}>\n <div className={classes.content} onClick={this.onClick.bind(this)} onTouchEnd={this.onTouch.bind(this)}>\n <div className={classes.iconHolder}>\n <CSSTransition timeout={400} in={toggled} exit={!toggled} classNames={classes}>\n <CorrectResponse open={toggled} key=\"correct-open\" className={classes.icon} />\n </CSSTransition>\n <CSSTransition timeout={5000} in={!toggled} exit={toggled} classNames={classes}>\n <CorrectResponse open={toggled} key=\"correct-closed\" className={classes.icon} />\n </CSSTransition>\n </div>\n <Readable false>\n <div className={classes.label} aria-hidden={!this.state.show}>\n {toggled ? hideMessage : showMessage}\n </div>\n </Readable>\n </div>\n </Expander>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(CorrectAnswerToggle);\n"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":["_styles","require","_CSSTransition","_interopRequireDefault","_icons","_renderUi","_expander","_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","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/CSSTransition';\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,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,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,C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QAAC,eAAa,CAAC,IAAI,CAACqB,KAAK,CAACC;MAAK,GACxCY,OAAO,GAAGP,WAAW,GAAGH,WACd,CACL,CACG,CACP,CACA,CAAC;IAEjB;EAAC;AAAA,EArGsCiC,iBAAK,CAACC,SAAS;AAAA,IAAAzE,gBAAA,aAA3C8B,mBAAmB,eACX;EACjBkB,QAAQ,EAAE0B,qBAAS,CAACC,IAAI;EACxB1B,OAAO,EAAEyB,qBAAS,CAACE,IAAI;EACvBvC,IAAI,EAAEqC,qBAAS,CAACE,IAAI;EACpBlC,WAAW,EAAEgC,qBAAS,CAACG,MAAM;EAC7BtC,WAAW,EAAEmC,qBAAS,CAACG,MAAM;EAC7BlB,SAAS,EAAEe,qBAAS,CAACG,MAAM;EAC3BpC,QAAQ,EAAEiC,qBAAS,CAACG;AACtB,CAAC;AAAA,IAAA7E,gBAAA,aATU8B,mBAAmB,kBAWR;EACpBS,WAAW,EAAE,qBAAqB;EAClCG,WAAW,EAAE,qBAAqB;EAClCL,IAAI,EAAE,KAAK;EACXY,OAAO,EAAE;AACX,CAAC;AAAA,IAAA6B,QAAA,GAAA/C,OAAA,cAwFYD,mBAAmB","ignoreList":[]}
package/package.json CHANGED
@@ -6,32 +6,36 @@
6
6
  "keywords": [
7
7
  "react",
8
8
  "pie",
9
- "material-ui"
9
+ "mui",
10
+ "@mui/material"
10
11
  ],
11
12
  "publishConfig": {
12
13
  "access": "public"
13
14
  },
14
- "version": "2.25.1",
15
+ "version": "2.26.0-mui-update.0",
15
16
  "main": "lib/index.js",
16
17
  "module": "src/index.jsx",
17
18
  "scripts": {},
18
19
  "dependencies": {
19
- "@material-ui/core": "^3.8.3",
20
- "@pie-lib/icons": "^2.24.1",
21
- "@pie-lib/render-ui": "^4.35.1",
22
- "@pie-lib/translator": "^2.23.1",
20
+ "@emotion/react": "^11.14.0",
21
+ "@emotion/style": "^0.8.0",
22
+ "@mui/icons-material": "^7.3.4",
23
+ "@mui/material": "^7.3.4",
24
+ "@pie-lib/icons": "^2.25.0-mui-update.0",
25
+ "@pie-lib/render-ui": "^4.36.0-mui-update.0",
26
+ "@pie-lib/translator": "^2.25.0-mui-update.0",
23
27
  "classnames": "^2.2.6",
24
28
  "lodash": "^4.17.11",
25
29
  "prop-types": "^15.6.2",
26
30
  "react-transition-group": "^2.5.2"
27
31
  },
28
32
  "devDependencies": {
29
- "react": "^16.8.1",
30
- "react-dom": "^16.9.0"
33
+ "react": "^18.2.0",
34
+ "react-dom": "^18.2.0"
31
35
  },
32
36
  "peerDependencies": {
33
- "react": "^16.8.1",
34
- "react-dom": "^16.8.1"
37
+ "react": "^18.2.0",
38
+ "react-dom": "^18.2.0"
35
39
  },
36
- "gitHead": "ce0ec7134200c51f3a3301257be3e707054b36ca"
40
+ "gitHead": "2e0222bda045f46b504640a972d43787e68288c4"
37
41
  }
package/src/expander.jsx CHANGED
@@ -1,37 +1,18 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
3
+ import { styled } from '@mui/material/styles';
4
4
  import { CSSTransition } from 'react-transition-group';
5
5
 
6
- const Expander = (props) => {
7
- const { classes, show, children } = props;
8
-
9
- return (
10
- <CSSTransition in={show} appear={true} mountOnEnter={false} timeout={300} classNames={{ ...classes }}>
11
- <div className={classes.expander}>{children}</div>
12
- </CSSTransition>
13
- );
14
- };
15
-
16
- Expander.propTypes = {
17
- show: PropTypes.bool.isRequired,
18
- className: PropTypes.string,
19
- classes: PropTypes.object,
20
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
21
- };
22
-
23
6
  const transition = 'height ease-in 300ms, opacity ease-in 300ms';
24
7
 
25
- export default withStyles(() => ({
26
- expander: {
27
- position: 'relative',
28
- height: 0,
29
- overflow: 'hidden',
30
- display: 'flex',
31
- visibility: 'hidden',
32
- width: 0,
33
- },
34
- enter: {
8
+ const StyledExpander = styled('div')(() => ({
9
+ position: 'relative',
10
+ height: 0,
11
+ overflow: 'hidden',
12
+ display: 'flex',
13
+ visibility: 'hidden',
14
+ width: 0,
15
+ '&.enter': {
35
16
  transition,
36
17
  opacity: 1,
37
18
  height: 'auto',
@@ -39,23 +20,52 @@ export default withStyles(() => ({
39
20
  visibility: 'visible',
40
21
  minHeight: '25px',
41
22
  },
42
- enterDone: {
23
+ '&.enter-done': {
43
24
  height: 'auto',
44
25
  visibility: 'visible',
45
26
  width: 'auto',
46
27
  minHeight: '25px',
47
28
  },
48
- exit: {
29
+ '&.exit': {
49
30
  transition,
50
31
  opacity: 0,
51
32
  height: 0,
52
33
  visibility: 'visible',
53
34
  width: 0,
54
35
  },
55
- exitDone: {
36
+ '&.exit-done': {
56
37
  opacity: 0,
57
38
  visibility: 'hidden',
58
39
  height: 0,
59
40
  width: 0,
60
41
  },
61
- }))(Expander);
42
+ }));
43
+
44
+ const Expander = (props) => {
45
+ const { show, children, className } = props;
46
+
47
+ return (
48
+ <CSSTransition
49
+ in={show}
50
+ appear={true}
51
+ mountOnEnter={false}
52
+ timeout={300}
53
+ classNames={{
54
+ enter: 'enter',
55
+ enterDone: 'enter-done',
56
+ exit: 'exit',
57
+ exitDone: 'exit-done'
58
+ }}
59
+ >
60
+ <StyledExpander className={className}>{children}</StyledExpander>
61
+ </CSSTransition>
62
+ );
63
+ };
64
+
65
+ Expander.propTypes = {
66
+ show: PropTypes.bool.isRequired,
67
+ className: PropTypes.string,
68
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
69
+ };
70
+
71
+ export default Expander;
package/src/index.jsx CHANGED
@@ -1,16 +1,71 @@
1
- import styles from './styles';
2
- import { withStyles } from '@material-ui/core/styles';
1
+ import { styled } from '@mui/material/styles';
3
2
  import CSSTransition from 'react-transition-group/CSSTransition';
4
3
  import { CorrectResponse } from '@pie-lib/icons';
5
4
  import { Readable } from '@pie-lib/render-ui';
6
5
  import Expander from './expander';
7
6
  import React from 'react';
8
- import classNames from 'classnames';
9
7
  import PropTypes from 'prop-types';
10
8
  import Translator from '@pie-lib/translator';
9
+ import { color } from '@pie-lib/render-ui';
11
10
 
12
11
  const { translator } = Translator;
13
12
 
13
+ const noTouch = {
14
+ '-webkit-touchCcallout': 'none',
15
+ '-webkit-user-select': 'none',
16
+ '-khtml-user-select': 'none',
17
+ '-moz-user-select': 'none',
18
+ '-ms-user-select': 'none',
19
+ 'user-select': 'none',
20
+ };
21
+
22
+ const StyledRoot = styled('div')(() => ({
23
+ width: '100%',
24
+ cursor: 'pointer',
25
+ }));
26
+
27
+ const StyledContent = styled('div')(() => ({
28
+ margin: '0 auto',
29
+ textAlign: 'center',
30
+ display: 'flex',
31
+ }));
32
+
33
+ const StyledLabel = styled('div')(() => ({
34
+ width: 'fit-content',
35
+ minWidth: '140px',
36
+ alignSelf: 'center',
37
+ verticalAlign: 'middle',
38
+ color: `var(--correct-answer-toggle-label-color, ${color.text()})`,
39
+ fontWeight: 'normal',
40
+ ...noTouch,
41
+ }));
42
+
43
+ const StyledIcon = styled('div')(() => ({
44
+ position: 'absolute',
45
+ width: '25px',
46
+ '&.enter': {
47
+ opacity: '0',
48
+ },
49
+ '&.enter-active': {
50
+ opacity: '1',
51
+ transition: 'opacity 0.3s ease-in',
52
+ },
53
+ '&.exit': {
54
+ opacity: '1',
55
+ },
56
+ '&.exit-active': {
57
+ opacity: '0',
58
+ transition: 'opacity 0.3s ease-in',
59
+ },
60
+ }));
61
+
62
+ const StyledIconHolder = styled('div')(() => ({
63
+ width: '25px',
64
+ marginRight: '5px',
65
+ display: 'flex',
66
+ alignItems: 'center',
67
+ }));
68
+
14
69
  /**
15
70
  * We export the raw unstyled class for testability. For public use please use the default export.
16
71
  */
@@ -21,7 +76,6 @@ export class CorrectAnswerToggle extends React.Component {
21
76
  show: PropTypes.bool,
22
77
  hideMessage: PropTypes.string,
23
78
  showMessage: PropTypes.string,
24
- classes: PropTypes.object.isRequired,
25
79
  className: PropTypes.string,
26
80
  language: PropTypes.string,
27
81
  };
@@ -69,30 +123,54 @@ export class CorrectAnswerToggle extends React.Component {
69
123
  }
70
124
 
71
125
  render() {
72
- const { classes, className, toggled, hideMessage, showMessage } = this.props;
126
+ const { className, toggled, hideMessage, showMessage } = this.props;
73
127
 
74
128
  return (
75
- <div className={classNames(classes.root, className)}>
76
- <Expander show={this.state.show} className={classes.expander}>
77
- <div className={classes.content} onClick={this.onClick.bind(this)} onTouchEnd={this.onTouch.bind(this)}>
78
- <div className={classes.iconHolder}>
79
- <CSSTransition timeout={400} in={toggled} exit={!toggled} classNames={classes}>
80
- <CorrectResponse open={toggled} key="correct-open" className={classes.icon} />
129
+ <StyledRoot className={className}>
130
+ <Expander show={this.state.show}>
131
+ <StyledContent onClick={this.onClick.bind(this)} onTouchEnd={this.onTouch.bind(this)}>
132
+ <StyledIconHolder>
133
+ <CSSTransition
134
+ timeout={400}
135
+ in={toggled}
136
+ exit={!toggled}
137
+ classNames={{
138
+ enter: 'enter',
139
+ enterActive: 'enter-active',
140
+ exit: 'exit',
141
+ exitActive: 'exit-active'
142
+ }}
143
+ >
144
+ <StyledIcon>
145
+ <CorrectResponse open={toggled} key="correct-open" />
146
+ </StyledIcon>
81
147
  </CSSTransition>
82
- <CSSTransition timeout={5000} in={!toggled} exit={toggled} classNames={classes}>
83
- <CorrectResponse open={toggled} key="correct-closed" className={classes.icon} />
148
+ <CSSTransition
149
+ timeout={5000}
150
+ in={!toggled}
151
+ exit={toggled}
152
+ classNames={{
153
+ enter: 'enter',
154
+ enterActive: 'enter-active',
155
+ exit: 'exit',
156
+ exitActive: 'exit-active'
157
+ }}
158
+ >
159
+ <StyledIcon>
160
+ <CorrectResponse open={toggled} key="correct-closed" />
161
+ </StyledIcon>
84
162
  </CSSTransition>
85
- </div>
163
+ </StyledIconHolder>
86
164
  <Readable false>
87
- <div className={classes.label} aria-hidden={!this.state.show}>
165
+ <StyledLabel aria-hidden={!this.state.show}>
88
166
  {toggled ? hideMessage : showMessage}
89
- </div>
167
+ </StyledLabel>
90
168
  </Readable>
91
- </div>
169
+ </StyledContent>
92
170
  </Expander>
93
- </div>
171
+ </StyledRoot>
94
172
  );
95
173
  }
96
174
  }
97
175
 
98
- export default withStyles(styles)(CorrectAnswerToggle);
176
+ export default CorrectAnswerToggle;
package/lib/styles.js DELETED
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.animationStyles = void 0;
7
-
8
- var _renderUi = require("@pie-lib/render-ui");
9
-
10
- var noTouch = {
11
- '-webkit-touchCcallout': 'none',
12
- '-webkit-user-select': 'none',
13
- '-khtml-user-select': 'none',
14
- '-moz-user-select': 'none',
15
- '-ms-user-select': 'none',
16
- 'user-select': 'none'
17
- };
18
- var _default = {
19
- root: {
20
- width: '100%',
21
- cursor: 'pointer'
22
- },
23
- content: {
24
- margin: '0 auto',
25
- textAlign: 'center',
26
- display: 'flex'
27
- },
28
- label: Object.assign({
29
- width: 'fit-content',
30
- minWidth: '140px',
31
- // eslint-disable-next-line
32
- alignSelf: 'center',
33
- verticalAlign: 'middle',
34
- color: "var(--correct-answer-toggle-label-color, ".concat(_renderUi.color.text(), ")"),
35
- fontWeight: 'normal'
36
- }, noTouch),
37
- icon: {
38
- position: 'absolute',
39
- width: '25px'
40
- },
41
- iconHolder: {
42
- width: '25px',
43
- marginRight: '5px',
44
- display: 'flex',
45
- alignItems: 'center'
46
- },
47
- enter: {
48
- opacity: '0'
49
- },
50
- enterActive: {
51
- opacity: '1',
52
- transition: 'opacity 0.3s ease-in'
53
- },
54
- exit: {
55
- opacity: '1'
56
- },
57
- exitActive: {
58
- opacity: '0',
59
- transition: 'opacity 0.3s ease-in'
60
- }
61
- };
62
- exports["default"] = _default;
63
- var animationStyles = {};
64
- exports.animationStyles = animationStyles;
65
- //# sourceMappingURL=styles.js.map
package/lib/styles.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/styles.js"],"names":["noTouch","root","width","cursor","content","margin","textAlign","display","label","Object","assign","minWidth","alignSelf","verticalAlign","color","text","fontWeight","icon","position","iconHolder","marginRight","alignItems","enter","opacity","enterActive","transition","exit","exitActive","animationStyles"],"mappings":";;;;;;;AAAA;;AAEA,IAAMA,OAAO,GAAG;AACd,2BAAyB,MADX;AAEd,yBAAuB,MAFT;AAGd,wBAAsB,MAHR;AAId,sBAAoB,MAJN;AAKd,qBAAmB,MALL;AAMd,iBAAe;AAND,CAAhB;eASe;AACbC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,MADH;AAEJC,IAAAA,MAAM,EAAE;AAFJ,GADO;AAKbC,EAAAA,OAAO,EAAE;AACPC,IAAAA,MAAM,EAAE,QADD;AAEPC,IAAAA,SAAS,EAAE,QAFJ;AAGPC,IAAAA,OAAO,EAAE;AAHF,GALI;AAUbC,EAAAA,KAAK,EAAEC,MAAM,CAACC,MAAP,CACL;AACER,IAAAA,KAAK,EAAE,aADT;AAEES,IAAAA,QAAQ,EAAE,OAFZ;AAGE;AACAC,IAAAA,SAAS,EAAE,QAJb;AAKEC,IAAAA,aAAa,EAAE,QALjB;AAMEC,IAAAA,KAAK,sDAA+CA,gBAAMC,IAAN,EAA/C,MANP;AAOEC,IAAAA,UAAU,EAAE;AAPd,GADK,EAULhB,OAVK,CAVM;AAsBbiB,EAAAA,IAAI,EAAE;AACJC,IAAAA,QAAQ,EAAE,UADN;AAEJhB,IAAAA,KAAK,EAAE;AAFH,GAtBO;AA0BbiB,EAAAA,UAAU,EAAE;AACVjB,IAAAA,KAAK,EAAE,MADG;AAEVkB,IAAAA,WAAW,EAAE,KAFH;AAGVb,IAAAA,OAAO,EAAE,MAHC;AAIVc,IAAAA,UAAU,EAAE;AAJF,GA1BC;AAgCbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE;AADJ,GAhCM;AAmCbC,EAAAA,WAAW,EAAE;AACXD,IAAAA,OAAO,EAAE,GADE;AAEXE,IAAAA,UAAU,EAAE;AAFD,GAnCA;AAuCbC,EAAAA,IAAI,EAAE;AACJH,IAAAA,OAAO,EAAE;AADL,GAvCO;AA0CbI,EAAAA,UAAU,EAAE;AACVJ,IAAAA,OAAO,EAAE,GADC;AAEVE,IAAAA,UAAU,EAAE;AAFF;AA1CC,C;;AAgDR,IAAMG,eAAe,GAAG,EAAxB","sourcesContent":["import { color } from '@pie-lib/render-ui';\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\nexport default {\n root: {\n width: '100%',\n cursor: 'pointer',\n },\n content: {\n margin: '0 auto',\n textAlign: 'center',\n display: 'flex',\n },\n label: Object.assign(\n {\n width: 'fit-content',\n minWidth: '140px',\n // eslint-disable-next-line\n alignSelf: 'center',\n verticalAlign: 'middle',\n color: `var(--correct-answer-toggle-label-color, ${color.text()})`,\n fontWeight: 'normal',\n },\n noTouch,\n ),\n icon: {\n position: 'absolute',\n width: '25px',\n },\n iconHolder: {\n width: '25px',\n marginRight: '5px',\n display: 'flex',\n alignItems: 'center',\n },\n enter: {\n opacity: '0',\n },\n enterActive: {\n opacity: '1',\n transition: 'opacity 0.3s ease-in',\n },\n exit: {\n opacity: '1',\n },\n exitActive: {\n opacity: '0',\n transition: 'opacity 0.3s ease-in',\n },\n};\n\nexport const animationStyles = {};\n"],"file":"styles.js"}
package/src/styles.js DELETED
@@ -1,60 +0,0 @@
1
- import { color } from '@pie-lib/render-ui';
2
-
3
- const noTouch = {
4
- '-webkit-touchCcallout': 'none',
5
- '-webkit-user-select': 'none',
6
- '-khtml-user-select': 'none',
7
- '-moz-user-select': 'none',
8
- '-ms-user-select': 'none',
9
- 'user-select': 'none',
10
- };
11
-
12
- export default {
13
- root: {
14
- width: '100%',
15
- cursor: 'pointer',
16
- },
17
- content: {
18
- margin: '0 auto',
19
- textAlign: 'center',
20
- display: 'flex',
21
- },
22
- label: Object.assign(
23
- {
24
- width: 'fit-content',
25
- minWidth: '140px',
26
- // eslint-disable-next-line
27
- alignSelf: 'center',
28
- verticalAlign: 'middle',
29
- color: `var(--correct-answer-toggle-label-color, ${color.text()})`,
30
- fontWeight: 'normal',
31
- },
32
- noTouch,
33
- ),
34
- icon: {
35
- position: 'absolute',
36
- width: '25px',
37
- },
38
- iconHolder: {
39
- width: '25px',
40
- marginRight: '5px',
41
- display: 'flex',
42
- alignItems: 'center',
43
- },
44
- enter: {
45
- opacity: '0',
46
- },
47
- enterActive: {
48
- opacity: '1',
49
- transition: 'opacity 0.3s ease-in',
50
- },
51
- exit: {
52
- opacity: '1',
53
- },
54
- exitActive: {
55
- opacity: '0',
56
- transition: 'opacity 0.3s ease-in',
57
- },
58
- };
59
-
60
- export const animationStyles = {};