@pie-lib/correct-answer-toggle 2.25.3-next.0 → 2.25.3-next.162

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.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.25.1...@pie-lib/correct-answer-toggle@2.25.2) (2025-11-27)
6
+ # [3.0.0-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.25.3-next.0...@pie-lib/correct-answer-toggle@3.0.0-next.0) (2026-01-19)
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.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)
14
+ ## [2.25.3-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.39.0-mui-update.0...@pie-lib/correct-answer-toggle@2.25.3-next.0) (2026-01-19)
15
15
 
16
16
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
17
17
 
@@ -19,141 +19,87 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- # [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)
22
+ ## [2.25.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.25.1...@pie-lib/correct-answer-toggle@2.25.2) (2025-11-27)
23
23
 
24
24
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
25
25
 
26
+ ## [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)
26
27
 
28
+ **Note:** Version bump only for package @pie-lib/correct-answer-toggle
27
29
 
30
+ # [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)
28
31
 
32
+ **Note:** Version bump only for package @pie-lib/correct-answer-toggle
29
33
 
30
34
  # [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)
31
35
 
32
36
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
33
37
 
34
-
35
-
36
-
37
-
38
38
  # [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)
39
39
 
40
40
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
41
41
 
42
-
43
-
44
-
45
-
46
42
  # [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)
47
43
 
48
44
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
49
45
 
50
-
51
-
52
-
53
-
54
46
  ## [2.21.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.1...@pie-lib/correct-answer-toggle@2.21.2) (2025-10-14)
55
47
 
56
48
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
57
49
 
58
-
59
-
60
-
61
-
62
50
  ## [2.21.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.21.0...@pie-lib/correct-answer-toggle@2.21.1) (2025-10-09)
63
51
 
64
52
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
65
53
 
66
-
67
-
68
-
69
-
70
54
  # [2.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.5.11...@pie-lib/correct-answer-toggle@2.21.0) (2025-09-25)
71
55
 
72
-
73
56
  ### Bug Fixes
74
57
 
75
- * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
76
-
58
+ - fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
77
59
 
78
60
  ### Features
79
61
 
80
- * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
81
-
82
-
83
-
84
-
62
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
85
63
 
86
64
  # [2.20.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.19.0...@pie-lib/correct-answer-toggle@2.20.0) (2025-09-18)
87
65
 
88
66
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
89
67
 
90
-
91
-
92
-
93
-
94
68
  # [2.19.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.18.0...@pie-lib/correct-answer-toggle@2.19.0) (2025-09-18)
95
69
 
96
70
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
97
71
 
98
-
99
-
100
-
101
-
102
72
  # [2.18.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.5.11...@pie-lib/correct-answer-toggle@2.18.0) (2025-09-18)
103
73
 
104
-
105
74
  ### Bug Fixes
106
75
 
107
- * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
108
-
76
+ - fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
109
77
 
110
78
  ### Features
111
79
 
112
- * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
113
-
114
-
115
-
116
-
80
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
117
81
 
118
82
  # [2.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.16.0...@pie-lib/correct-answer-toggle@2.17.0) (2025-09-17)
119
83
 
120
84
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
121
85
 
122
-
123
-
124
-
125
-
126
86
  # [2.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.15.0...@pie-lib/correct-answer-toggle@2.16.0) (2025-09-17)
127
87
 
128
88
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
129
89
 
130
-
131
-
132
-
133
-
134
90
  # [2.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.14.1...@pie-lib/correct-answer-toggle@2.15.0) (2025-09-17)
135
91
 
136
92
  **Note:** Version bump only for package @pie-lib/correct-answer-toggle
137
93
 
138
-
139
-
140
-
141
-
142
94
  ## [2.14.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.5.11...@pie-lib/correct-answer-toggle@2.14.1) (2025-08-11)
143
95
 
144
-
145
96
  ### Bug Fixes
146
97
 
147
- * fixed pie-lib/icons import [PD-5126] ([dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f))
148
-
98
+ - fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
149
99
 
150
100
  ### Features
151
101
 
152
- * split pie-toolbox into multiple packages [PD-5126] ([7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2))
153
-
154
-
155
-
156
-
102
+ - split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
157
103
 
158
104
  # [2.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/correct-answer-toggle@2.5.11...@pie-lib/correct-answer-toggle@2.14.0) (2025-08-07)
159
105
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/lib/expander.js CHANGED
@@ -1,60 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _react = _interopRequireDefault(require("react"));
13
-
9
+ var _react = _interopRequireWildcard(require("react"));
14
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
- var _styles = require("@material-ui/core/styles");
17
-
11
+ var _styles = require("@mui/material/styles");
18
12
  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
- };
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
45
14
  var transition = 'height ease-in 300ms, opacity ease-in 300ms';
46
-
47
- var _default = (0, _styles.withStyles)(function () {
15
+ var StyledExpander = (0, _styles.styled)('div')(function () {
48
16
  return {
49
- expander: {
50
- position: 'relative',
51
- height: 0,
52
- overflow: 'hidden',
53
- display: 'flex',
54
- visibility: 'hidden',
55
- width: 0
56
- },
57
- enter: {
17
+ position: 'relative',
18
+ height: 0,
19
+ overflow: 'hidden',
20
+ display: 'flex',
21
+ visibility: 'hidden',
22
+ width: 0,
23
+ '&.enter': {
58
24
  transition: transition,
59
25
  opacity: 1,
60
26
  height: 'auto',
@@ -62,27 +28,52 @@ var _default = (0, _styles.withStyles)(function () {
62
28
  visibility: 'visible',
63
29
  minHeight: '25px'
64
30
  },
65
- enterDone: {
31
+ '&.enter-done': {
66
32
  height: 'auto',
67
33
  visibility: 'visible',
68
34
  width: 'auto',
69
35
  minHeight: '25px'
70
36
  },
71
- exit: {
37
+ '&.exit': {
72
38
  transition: transition,
73
39
  opacity: 0,
74
40
  height: 0,
75
41
  visibility: 'visible',
76
42
  width: 0
77
43
  },
78
- exitDone: {
44
+ '&.exit-done': {
79
45
  opacity: 0,
80
46
  visibility: 'hidden',
81
47
  height: 0,
82
48
  width: 0
83
49
  }
84
50
  };
85
- })(Expander);
86
-
87
- exports["default"] = _default;
51
+ });
52
+ var Expander = function Expander(props) {
53
+ var show = props.show,
54
+ children = props.children,
55
+ className = props.className;
56
+ var nodeRef = (0, _react.useRef)(null);
57
+ return /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
58
+ nodeRef: nodeRef,
59
+ "in": show,
60
+ appear: true,
61
+ mountOnEnter: false,
62
+ timeout: 300,
63
+ classNames: {
64
+ enter: 'enter',
65
+ enterDone: 'enter-done',
66
+ exit: 'exit',
67
+ exitDone: 'exit-done'
68
+ }
69
+ }, /*#__PURE__*/_react["default"].createElement(StyledExpander, {
70
+ className: className
71
+ }, children));
72
+ };
73
+ Expander.propTypes = {
74
+ show: _propTypes["default"].bool.isRequired,
75
+ className: _propTypes["default"].string,
76
+ children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
77
+ };
78
+ var _default = exports["default"] = Expander;
88
79
  //# 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","_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'\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,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,C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AQ;IAAEC,SAAS,GAAKH,KAAK,CAAnBG,SAAS;EACjC,IAAMC,OAAO,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAE5B,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;IAACc,SAAS,EAAEA;EAAU,GAAED,QAAyB,CACnD,CAAC;AAEpB,CAAC;AAEDH,QAAQ,CAACiB,SAAS,GAAG;EACnBf,IAAI,EAAEgB,qBAAS,CAACC,IAAI,CAACC,UAAU;EAC/BhB,SAAS,EAAEc,qBAAS,CAACG,MAAM;EAC3BlB,QAAQ,EAAEe,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,cAEa1B,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
-
26
- var _CSSTransition = _interopRequireDefault(require("react-transition-group/CSSTransition"));
27
-
14
+ var _styles = require("@mui/material/styles");
15
+ var _reactTransitionGroup = require("react-transition-group");
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(_reactTransitionGroup.CSSTransition, {
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(_reactTransitionGroup.CSSTransition, {
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;;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,SAAS,EAAEK,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","_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,OAAA,CAAAC,SAAA,CAAAN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AAA2F,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":[]}
package/package.json CHANGED
@@ -6,32 +6,43 @@
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.3-next.0+f60e2119",
15
+ "version": "2.25.3-next.162+b5949758",
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.3-next.0+f60e2119",
22
- "@pie-lib/translator": "^2.23.1",
23
- "classnames": "^2.2.6",
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.24.2-next.164",
25
+ "@pie-lib/render-ui": "4.35.3-next.155",
26
+ "@pie-lib/translator": "2.23.2-next.164",
24
27
  "lodash": "^4.17.11",
25
28
  "prop-types": "^15.6.2",
26
- "react-transition-group": "^2.5.2"
29
+ "react-transition-group": "^4.4.5"
27
30
  },
28
31
  "devDependencies": {
29
- "react": "^16.8.1",
30
- "react-dom": "^16.9.0"
32
+ "react": "^18.2.0",
33
+ "react-dom": "^18.2.0"
31
34
  },
32
35
  "peerDependencies": {
33
- "react": "^16.8.1",
34
- "react-dom": "^16.8.1"
36
+ "react": "^18.2.0",
37
+ "react-dom": "^18.2.0"
35
38
  },
36
- "gitHead": "f60e2119a935158e52eb23ce81969dc5b75b1db8"
39
+ "gitHead": "b5949758ca5c537e02a14fbbf99d4cde4729255e",
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
+ }
37
48
  }
@@ -1,99 +1,91 @@
1
- import { mount, shallow, configure } from 'enzyme';
2
-
3
- import Expander from '../expander';
1
+ import { render, screen } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
4
3
  import React from 'react';
5
4
  import { CorrectAnswerToggle } from '../index';
6
- import Adapter from 'enzyme-adapter-react-16';
7
-
8
- configure({ adapter: new Adapter() });
9
5
 
10
6
  describe('CorrectAnswerToggle', () => {
11
7
  let onToggle;
12
- let wrapper;
13
- let sheet;
14
8
 
15
- let mkWrapper = (toggled, msgs) => {
16
- toggled = toggled === false ? false : true;
17
- msgs = msgs || {};
18
- return shallow(
9
+ const renderComponent = (toggled = true, msgs = {}) => {
10
+ return render(
19
11
  <CorrectAnswerToggle
12
+ show={true}
20
13
  toggled={toggled}
21
- classes={{
22
- root: 'root',
23
- label: 'label',
24
- }}
25
14
  onToggle={onToggle}
26
15
  hideMessage={msgs.hide}
27
16
  showMessage={msgs.show}
28
- sheet={sheet}
29
17
  />,
30
- {
31
- context: {},
32
- },
33
18
  );
34
19
  };
35
20
 
36
21
  beforeEach(() => {
37
- let iconStub = {};
38
-
39
- sheet = {
40
- classes: {
41
- root: 'root',
42
- label: 'label',
43
- },
44
- };
45
22
  onToggle = jest.fn();
46
- wrapper = mkWrapper();
47
23
  });
48
24
 
49
- describe('render', () => {
50
- it('has the hide message', () => {
51
- let holder = wrapper.find('.label');
52
- expect(holder.text()).toEqual('Hide correct answer');
25
+ describe('rendering', () => {
26
+ it('shows hide message when toggled is true', () => {
27
+ renderComponent(true);
28
+ expect(screen.getByText('Hide correct answer')).toBeInTheDocument();
53
29
  });
54
30
 
55
- it('has show message when toggled is false', () => {
56
- const w = mkWrapper(false);
57
- let holder = w.find(`.label`);
58
- expect(holder.text()).toEqual('Show correct answer');
31
+ it('shows show message when toggled is false', () => {
32
+ renderComponent(false);
33
+ expect(screen.getByText('Show correct answer')).toBeInTheDocument();
59
34
  });
60
35
 
61
- it('sets a custom hide message', () => {
62
- wrapper = mkWrapper(true, { hide: 'hide!' });
63
- let holder = wrapper.find('.label');
64
- expect(holder.text()).toEqual('hide!');
36
+ it('displays custom hide message', () => {
37
+ renderComponent(true, { hide: 'hide!' });
38
+ expect(screen.getByText('hide!')).toBeInTheDocument();
65
39
  });
66
40
 
67
- it('sets a custom show message', () => {
68
- wrapper = mkWrapper(false, { show: 'show!' });
69
- let holder = wrapper.find('.label');
70
- expect(holder.text()).toEqual('show!');
41
+ it('displays custom show message', () => {
42
+ renderComponent(false, { show: 'show!' });
43
+ expect(screen.getByText('show!')).toBeInTheDocument();
71
44
  });
72
45
  });
73
46
 
74
- describe('onClick', () => {
75
- it('calls onToggle', () => {
76
- wrapper
77
- .find(Expander)
78
- .childAt(0)
79
- .simulate('click');
80
- expect(onToggle.mock.calls[0][0]).toEqual(false);
47
+ describe('user interactions', () => {
48
+ it('calls onToggle with false when clicked while toggled', async () => {
49
+ const user = userEvent.setup();
50
+ renderComponent(true);
51
+
52
+ const button = screen.getByText('Hide correct answer');
53
+ await user.click(button);
54
+
55
+ expect(onToggle).toHaveBeenCalledWith(false);
81
56
  });
82
57
 
83
- it('calls onToggle with update state', () => {
84
- onToggle.mockReset();
85
- wrapper
86
- .find(Expander)
87
- .childAt(0)
88
- .simulate('click');
89
- expect(onToggle.mock.calls[0][0]).toEqual(false);
90
- //simulate updating the toggled prop
91
- wrapper.setProps({ toggled: false });
92
- wrapper
93
- .find(Expander)
94
- .childAt(0)
95
- .simulate('click');
96
- expect(onToggle.mock.calls[1][0]).toEqual(true);
58
+ it('calls onToggle with true when clicked while not toggled', async () => {
59
+ const user = userEvent.setup();
60
+ renderComponent(false);
61
+
62
+ const button = screen.getByText('Show correct answer');
63
+ await user.click(button);
64
+
65
+ expect(onToggle).toHaveBeenCalledWith(true);
66
+ });
67
+
68
+ it('toggles correctly after prop update', async () => {
69
+ const user = userEvent.setup();
70
+ const { rerender } = renderComponent(true);
71
+
72
+ // First click - toggled is true, should call with false
73
+ await user.click(screen.getByText('Hide correct answer'));
74
+ expect(onToggle).toHaveBeenCalledWith(false);
75
+
76
+ // Simulate prop update to toggled=false
77
+ onToggle.mockClear();
78
+ rerender(
79
+ <CorrectAnswerToggle
80
+ show={true}
81
+ toggled={false}
82
+ onToggle={onToggle}
83
+ />
84
+ );
85
+
86
+ // Second click - toggled is false, should call with true
87
+ await user.click(screen.getByText('Show correct answer'));
88
+ expect(onToggle).toHaveBeenCalledWith(true);
97
89
  });
98
90
  });
99
91
  });
package/src/expander.jsx CHANGED
@@ -1,37 +1,18 @@
1
- import React from 'react';
1
+ import React, { useRef } 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,54 @@ 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
+ const nodeRef = useRef(null);
47
+
48
+ return (
49
+ <CSSTransition
50
+ nodeRef={nodeRef}
51
+ in={show}
52
+ appear={true}
53
+ mountOnEnter={false}
54
+ timeout={300}
55
+ classNames={{
56
+ enter: 'enter',
57
+ enterDone: 'enter-done',
58
+ exit: 'exit',
59
+ exitDone: 'exit-done'
60
+ }}
61
+ >
62
+ <StyledExpander className={className}>{children}</StyledExpander>
63
+ </CSSTransition>
64
+ );
65
+ };
66
+
67
+ Expander.propTypes = {
68
+ show: PropTypes.bool.isRequired,
69
+ className: PropTypes.string,
70
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
71
+ };
72
+
73
+ 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';
3
- import CSSTransition from 'react-transition-group/CSSTransition';
1
+ import { styled } from '@mui/material/styles';
2
+ import { CSSTransition } from 'react-transition-group';
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 = {};