@pie-lib/correct-answer-toggle 2.25.3-next.2 → 2.25.3-next.208
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 +13 -67
- package/lib/expander.js +44 -52
- package/lib/expander.js.map +1 -1
- package/lib/index.js +106 -76
- package/lib/index.js.map +1 -1
- package/package.json +16 -21
- package/src/__tests__/index.test.jsx +58 -66
- package/src/expander.jsx +47 -33
- package/src/index.jsx +101 -21
- package/esm/index.css +0 -847
- package/esm/index.js +0 -111219
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -3
- package/lib/styles.js +0 -65
- package/lib/styles.js.map +0 -1
- package/src/styles.js +0 -60
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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,53 @@ var _default = (0, _styles.withStyles)(function () {
|
|
|
62
28
|
visibility: 'visible',
|
|
63
29
|
minHeight: '25px'
|
|
64
30
|
},
|
|
65
|
-
|
|
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
|
-
|
|
44
|
+
'&.exit-done': {
|
|
79
45
|
opacity: 0,
|
|
80
46
|
visibility: 'hidden',
|
|
81
47
|
height: 0,
|
|
82
48
|
width: 0
|
|
83
49
|
}
|
|
84
50
|
};
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
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
|
+
ref: nodeRef,
|
|
71
|
+
className: className
|
|
72
|
+
}, children));
|
|
73
|
+
};
|
|
74
|
+
Expander.propTypes = {
|
|
75
|
+
show: _propTypes["default"].bool.isRequired,
|
|
76
|
+
className: _propTypes["default"].string,
|
|
77
|
+
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
|
|
78
|
+
};
|
|
79
|
+
var _default = exports["default"] = Expander;
|
|
88
80
|
//# sourceMappingURL=expander.js.map
|
package/lib/expander.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"expander.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_styles","_reactTransitionGroup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","transition","StyledExpander","styled","position","height","overflow","display","visibility","width","opacity","minHeight","Expander","props","show","children","className","nodeRef","useRef","createElement","CSSTransition","appear","mountOnEnter","timeout","classNames","enter","enterDone","exit","exitDone","ref","propTypes","PropTypes","bool","isRequired","string","oneOfType","arrayOf","node","_default","exports"],"sources":["../src/expander.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { CSSTransition } from 'react-transition-group';\n\nconst transition = 'height ease-in 300ms, opacity ease-in 300ms';\n\nconst StyledExpander = styled('div')(() => ({\n position: 'relative',\n height: 0,\n overflow: 'hidden',\n display: 'flex',\n visibility: 'hidden',\n width: 0,\n '&.enter': {\n transition,\n opacity: 1,\n height: 'auto',\n width: 'auto',\n visibility: 'visible',\n minHeight: '25px',\n },\n '&.enter-done': {\n height: 'auto',\n visibility: 'visible',\n width: 'auto',\n minHeight: '25px',\n },\n '&.exit': {\n transition,\n opacity: 0,\n height: 0,\n visibility: 'visible',\n width: 0,\n },\n '&.exit-done': {\n opacity: 0,\n visibility: 'hidden',\n height: 0,\n width: 0,\n },\n}));\n\nconst Expander = (props) => {\n const { show, children, className } = props;\n const nodeRef = useRef(null);\n\n return (\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n appear={true}\n mountOnEnter={false}\n timeout={300}\n classNames={{\n enter: 'enter',\n enterDone: 'enter-done',\n exit: 'exit',\n exitDone: 'exit-done',\n }}\n >\n <StyledExpander ref={nodeRef} className={className}>\n {children}\n </StyledExpander>\n </CSSTransition>\n );\n};\n\nExpander.propTypes = {\n show: PropTypes.bool.isRequired,\n className: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n};\n\nexport default Expander;\n"],"mappings":"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","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -1,70 +1,102 @@
|
|
|
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
|
|
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
|
|
43
|
-
|
|
44
|
-
function _objectSpread(
|
|
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 =
|
|
94
|
+
_this = _callSuper(this, CorrectAnswerToggle, [props]);
|
|
65
95
|
_this.state = {
|
|
66
96
|
show: props.show
|
|
67
97
|
};
|
|
98
|
+
_this.openIconRef = /*#__PURE__*/_react["default"].createRef();
|
|
99
|
+
_this.closedIconRef = /*#__PURE__*/_react["default"].createRef();
|
|
68
100
|
CorrectAnswerToggle.defaultProps = _objectSpread(_objectSpread({}, CorrectAnswerToggle.defaultProps), {}, {
|
|
69
101
|
showMessage: translator.t('common:showCorrectAnswer', {
|
|
70
102
|
lng: props.language
|
|
@@ -75,8 +107,8 @@ var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
|
|
|
75
107
|
});
|
|
76
108
|
return _this;
|
|
77
109
|
}
|
|
78
|
-
|
|
79
|
-
(0, _createClass2["default"])(CorrectAnswerToggle, [{
|
|
110
|
+
(0, _inherits2["default"])(CorrectAnswerToggle, _React$Component);
|
|
111
|
+
return (0, _createClass2["default"])(CorrectAnswerToggle, [{
|
|
80
112
|
key: "onClick",
|
|
81
113
|
value: function onClick() {
|
|
82
114
|
this.props.onToggle(!this.props.toggled);
|
|
@@ -85,18 +117,15 @@ var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
|
|
|
85
117
|
key: "onTouch",
|
|
86
118
|
value: function onTouch(event) {
|
|
87
119
|
event.preventDefault(); // Prevents the default action (click event)
|
|
88
|
-
|
|
89
120
|
this.props.onToggle(!this.props.toggled);
|
|
90
121
|
}
|
|
91
122
|
}, {
|
|
92
123
|
key: "UNSAFE_componentWillReceiveProps",
|
|
93
124
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
94
125
|
var _this$props;
|
|
95
|
-
|
|
96
126
|
this.setState({
|
|
97
127
|
show: nextProps.show
|
|
98
128
|
});
|
|
99
|
-
|
|
100
129
|
if (nextProps.language !== ((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.language)) {
|
|
101
130
|
CorrectAnswerToggle.defaultProps = _objectSpread(_objectSpread({}, CorrectAnswerToggle.defaultProps), {}, {
|
|
102
131
|
showMessage: translator.t('common:showCorrectAnswer', {
|
|
@@ -112,59 +141,63 @@ var CorrectAnswerToggle = /*#__PURE__*/function (_React$Component) {
|
|
|
112
141
|
key: "render",
|
|
113
142
|
value: function render() {
|
|
114
143
|
var _this$props2 = this.props,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
className: (0, _classnames["default"])(classes.root, className)
|
|
144
|
+
className = _this$props2.className,
|
|
145
|
+
toggled = _this$props2.toggled,
|
|
146
|
+
hideMessage = _this$props2.hideMessage,
|
|
147
|
+
showMessage = _this$props2.showMessage;
|
|
148
|
+
return /*#__PURE__*/_react["default"].createElement(StyledRoot, {
|
|
149
|
+
className: className
|
|
122
150
|
}, /*#__PURE__*/_react["default"].createElement(_expander["default"], {
|
|
123
|
-
show: this.state.show
|
|
124
|
-
|
|
125
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
126
|
-
className: classes.content,
|
|
151
|
+
show: this.state.show
|
|
152
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledContent, {
|
|
127
153
|
onClick: this.onClick.bind(this),
|
|
128
154
|
onTouchEnd: this.onTouch.bind(this)
|
|
129
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
130
|
-
|
|
131
|
-
}, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
|
|
155
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledIconHolder, null, /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
|
|
156
|
+
nodeRef: this.openIconRef,
|
|
132
157
|
timeout: 400,
|
|
133
158
|
"in": toggled,
|
|
134
159
|
exit: !toggled,
|
|
135
|
-
classNames:
|
|
160
|
+
classNames: {
|
|
161
|
+
enter: 'enter',
|
|
162
|
+
enterActive: 'enter-active',
|
|
163
|
+
exit: 'exit',
|
|
164
|
+
exitActive: 'exit-active'
|
|
165
|
+
}
|
|
166
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledIcon, {
|
|
167
|
+
ref: this.openIconRef
|
|
136
168
|
}, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
|
|
137
169
|
open: toggled,
|
|
138
|
-
key: "correct-open"
|
|
139
|
-
|
|
140
|
-
|
|
170
|
+
key: "correct-open"
|
|
171
|
+
}))), /*#__PURE__*/_react["default"].createElement(_reactTransitionGroup.CSSTransition, {
|
|
172
|
+
nodeRef: this.closedIconRef,
|
|
141
173
|
timeout: 5000,
|
|
142
174
|
"in": !toggled,
|
|
143
175
|
exit: toggled,
|
|
144
|
-
classNames:
|
|
176
|
+
classNames: {
|
|
177
|
+
enter: 'enter',
|
|
178
|
+
enterActive: 'enter-active',
|
|
179
|
+
exit: 'exit',
|
|
180
|
+
exitActive: 'exit-active'
|
|
181
|
+
}
|
|
182
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledIcon, {
|
|
183
|
+
ref: this.closedIconRef
|
|
145
184
|
}, /*#__PURE__*/_react["default"].createElement(_icons.CorrectResponse, {
|
|
146
185
|
open: toggled,
|
|
147
|
-
key: "correct-closed"
|
|
148
|
-
|
|
149
|
-
}))), /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
186
|
+
key: "correct-closed"
|
|
187
|
+
})))), /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
150
188
|
"false": true
|
|
151
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
152
|
-
className: classes.label,
|
|
189
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
|
|
153
190
|
"aria-hidden": !this.state.show
|
|
154
191
|
}, toggled ? hideMessage : showMessage)))));
|
|
155
192
|
}
|
|
156
193
|
}]);
|
|
157
|
-
return CorrectAnswerToggle;
|
|
158
194
|
}(_react["default"].Component);
|
|
159
|
-
|
|
160
|
-
exports.CorrectAnswerToggle = CorrectAnswerToggle;
|
|
161
195
|
(0, _defineProperty2["default"])(CorrectAnswerToggle, "propTypes", {
|
|
162
196
|
onToggle: _propTypes["default"].func,
|
|
163
197
|
toggled: _propTypes["default"].bool,
|
|
164
198
|
show: _propTypes["default"].bool,
|
|
165
199
|
hideMessage: _propTypes["default"].string,
|
|
166
200
|
showMessage: _propTypes["default"].string,
|
|
167
|
-
classes: _propTypes["default"].object.isRequired,
|
|
168
201
|
className: _propTypes["default"].string,
|
|
169
202
|
language: _propTypes["default"].string
|
|
170
203
|
});
|
|
@@ -174,8 +207,5 @@ exports.CorrectAnswerToggle = CorrectAnswerToggle;
|
|
|
174
207
|
show: false,
|
|
175
208
|
toggled: false
|
|
176
209
|
});
|
|
177
|
-
|
|
178
|
-
var _default = (0, _styles2.withStyles)(_styles["default"])(CorrectAnswerToggle);
|
|
179
|
-
|
|
180
|
-
exports["default"] = _default;
|
|
210
|
+
var _default = exports["default"] = CorrectAnswerToggle;
|
|
181
211
|
//# sourceMappingURL=index.js.map
|