@pie-lib/text-select 1.39.1-mui-update.0 → 1.40.0-mui-update.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/lib/legend.js +26 -29
- package/lib/legend.js.map +1 -1
- package/lib/token-select/token.js +29 -40
- package/lib/token-select/token.js.map +1 -1
- package/package.json +6 -6
- package/src/legend.js +11 -14
- package/src/token-select/token.jsx +16 -23
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
# [1.40.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.39.1-mui-update.0...@pie-lib/text-select@1.40.0-mui-update.0) (2025-11-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* diaable toggling selection in view mode ([c0e47f0](https://github.com/pie-framework/pie-lib/commit/c0e47f0f5beaced697d6cdf3c418b92ec29679ab))
|
|
12
|
+
* parsefloat to correctly compute tokens line height ([282c464](https://github.com/pie-framework/pie-lib/commit/282c464b860dc72e08d8692a7c2236c5475e49e0))
|
|
13
|
+
* **text-select:** refactor icon token wrappers,delete unused container ([fdc6066](https://github.com/pie-framework/pie-lib/commit/fdc60661dd3bbda8c936a5e495be75ac4a2ac2ea))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [1.39.1-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.39.0-mui-update.0...@pie-lib/text-select@1.39.1-mui-update.0) (2025-11-20)
|
|
7
20
|
|
|
8
21
|
|
package/lib/legend.js
CHANGED
|
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.Legend = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _styles = require("@mui/material/styles");
|
|
10
11
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
11
12
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
12
13
|
var _renderUi = require("@pie-lib/render-ui");
|
|
13
14
|
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
14
17
|
var translator = _translator["default"].translator;
|
|
15
18
|
var StyledFlexContainer = (0, _styles.styled)('div')(function (_ref) {
|
|
16
19
|
var theme = _ref.theme;
|
|
@@ -58,51 +61,46 @@ var StyledMissingContainer = (0, _styles.styled)(StyledContainer)(function () {
|
|
|
58
61
|
border: "".concat(_renderUi.color.incorrectWithIcon(), " dashed 2px")
|
|
59
62
|
};
|
|
60
63
|
});
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
var StyledCorrectIcon = (0, _styles.styled)(StyledIcon)(function () {
|
|
73
|
-
return {
|
|
64
|
+
var baseIconStyles = {
|
|
65
|
+
color: _renderUi.color.white(),
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: '-8px',
|
|
68
|
+
left: '-8px',
|
|
69
|
+
borderRadius: '50%',
|
|
70
|
+
fontSize: '12px',
|
|
71
|
+
padding: '2px'
|
|
72
|
+
};
|
|
73
|
+
var StyledCorrectCheckIcon = (0, _styles.styled)(_Check["default"])(function () {
|
|
74
|
+
return _objectSpread(_objectSpread({}, baseIconStyles), {}, {
|
|
74
75
|
backgroundColor: _renderUi.color.correctTertiary()
|
|
75
|
-
};
|
|
76
|
+
});
|
|
76
77
|
});
|
|
77
|
-
var
|
|
78
|
-
return {
|
|
78
|
+
var StyledIncorrectCloseIcon = (0, _styles.styled)(_Close["default"])(function () {
|
|
79
|
+
return _objectSpread(_objectSpread({}, baseIconStyles), {}, {
|
|
79
80
|
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
80
|
-
};
|
|
81
|
+
});
|
|
81
82
|
});
|
|
82
83
|
var Legend = exports.Legend = function Legend(_ref3) {
|
|
83
84
|
var language = _ref3.language,
|
|
84
85
|
showOnlyCorrect = _ref3.showOnlyCorrect;
|
|
85
86
|
var legendItems = [{
|
|
86
|
-
Icon:
|
|
87
|
+
Icon: StyledCorrectCheckIcon,
|
|
87
88
|
label: translator.t('selectText.correctAnswerSelected', {
|
|
88
89
|
lng: language
|
|
89
90
|
}),
|
|
90
|
-
Container: StyledCorrectContainer
|
|
91
|
-
IconComponent: StyledCorrectIcon
|
|
91
|
+
Container: StyledCorrectContainer
|
|
92
92
|
}, {
|
|
93
|
-
Icon:
|
|
93
|
+
Icon: StyledIncorrectCloseIcon,
|
|
94
94
|
label: translator.t('selectText.incorrectSelection', {
|
|
95
95
|
lng: language
|
|
96
96
|
}),
|
|
97
|
-
Container: StyledIncorrectContainer
|
|
98
|
-
IconComponent: StyledIncorrectIcon
|
|
97
|
+
Container: StyledIncorrectContainer
|
|
99
98
|
}, {
|
|
100
|
-
Icon:
|
|
99
|
+
Icon: StyledIncorrectCloseIcon,
|
|
101
100
|
label: translator.t('selectText.correctAnswerNotSelected', {
|
|
102
101
|
lng: language
|
|
103
102
|
}),
|
|
104
|
-
Container: StyledMissingContainer
|
|
105
|
-
IconComponent: StyledIncorrectIcon
|
|
103
|
+
Container: StyledMissingContainer
|
|
106
104
|
}];
|
|
107
105
|
if (showOnlyCorrect) {
|
|
108
106
|
legendItems.splice(1, 2);
|
|
@@ -112,11 +110,10 @@ var Legend = exports.Legend = function Legend(_ref3) {
|
|
|
112
110
|
})), legendItems.map(function (_ref4, idx) {
|
|
113
111
|
var Icon = _ref4.Icon,
|
|
114
112
|
label = _ref4.label,
|
|
115
|
-
Container = _ref4.Container
|
|
116
|
-
IconComponent = _ref4.IconComponent;
|
|
113
|
+
Container = _ref4.Container;
|
|
117
114
|
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
118
115
|
key: idx
|
|
119
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
116
|
+
}, /*#__PURE__*/_react["default"].createElement(Icon, null), /*#__PURE__*/_react["default"].createElement("span", null, label));
|
|
120
117
|
}));
|
|
121
118
|
};
|
|
122
119
|
//# sourceMappingURL=legend.js.map
|
package/lib/legend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.js","names":["_react","_interopRequireDefault","require","_styles","_Check","_Close","_renderUi","_translator","translator","Translator","StyledFlexContainer","styled","_ref","theme","display","flexDirection","alignItems","gap","spacing","borderBottom","borderTop","paddingBottom","paddingTop","marginBottom","StyledKey","_ref2","fontSize","fontWeight","color","black","marginLeft","StyledContainer","position","padding","borderRadius","StyledCorrectContainer","border","concat","correctTertiary","StyledIncorrectContainer","incorrectWithIcon","StyledMissingContainer","
|
|
1
|
+
{"version":3,"file":"legend.js","names":["_react","_interopRequireDefault","require","_styles","_Check","_Close","_renderUi","_translator","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","translator","Translator","StyledFlexContainer","styled","_ref","theme","display","flexDirection","alignItems","gap","spacing","borderBottom","borderTop","paddingBottom","paddingTop","marginBottom","StyledKey","_ref2","fontSize","fontWeight","color","black","marginLeft","StyledContainer","position","padding","borderRadius","StyledCorrectContainer","border","concat","correctTertiary","StyledIncorrectContainer","incorrectWithIcon","StyledMissingContainer","baseIconStyles","white","top","left","StyledCorrectCheckIcon","Check","backgroundColor","StyledIncorrectCloseIcon","Close","Legend","exports","_ref3","language","showOnlyCorrect","legendItems","Icon","label","lng","Container","splice","createElement","map","_ref4","idx","key"],"sources":["../src/legend.js"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport Check from '@mui/icons-material/Check';\nimport Close from '@mui/icons-material/Close';\nimport { color } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst StyledFlexContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n borderBottom: '1px solid lightgrey',\n borderTop: '1px solid lightgrey',\n paddingBottom: theme.spacing(1),\n paddingTop: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}));\n\nconst StyledKey = styled('span')(({ theme }) => ({\n fontSize: '14px',\n fontWeight: 'bold',\n color: color.black(),\n marginLeft: theme.spacing(1),\n}));\n\nconst StyledContainer = styled('div')(() => ({\n position: 'relative',\n padding: '4px',\n fontSize: '14px',\n borderRadius: '4px',\n}));\n\nconst StyledCorrectContainer = styled(StyledContainer)(() => ({\n border: `${color.correctTertiary()} solid 2px`,\n}));\n\nconst StyledIncorrectContainer = styled(StyledContainer)(() => ({\n border: `${color.incorrectWithIcon()} solid 2px`,\n}));\n\nconst StyledMissingContainer = styled(StyledContainer)(() => ({\n border: `${color.incorrectWithIcon()} dashed 2px`,\n}));\n\nconst baseIconStyles = {\n color: color.white(),\n position: 'absolute',\n top: '-8px',\n left: '-8px',\n borderRadius: '50%',\n fontSize: '12px',\n padding: '2px',\n};\n\nconst StyledCorrectCheckIcon = styled(Check)(() => ({\n ...baseIconStyles,\n backgroundColor: color.correctTertiary(),\n}));\n\nconst StyledIncorrectCloseIcon = styled(Close)(() => ({\n ...baseIconStyles,\n backgroundColor: color.incorrectWithIcon(),\n}));\n\nexport const Legend = ({ language, showOnlyCorrect }) => {\n const legendItems = [\n {\n Icon: StyledCorrectCheckIcon,\n label: translator.t('selectText.correctAnswerSelected', { lng: language }),\n Container: StyledCorrectContainer,\n },\n {\n Icon: StyledIncorrectCloseIcon,\n label: translator.t('selectText.incorrectSelection', { lng: language }),\n Container: StyledIncorrectContainer,\n },\n {\n Icon: StyledIncorrectCloseIcon,\n label: translator.t('selectText.correctAnswerNotSelected', { lng: language }),\n Container: StyledMissingContainer,\n },\n ];\n\n if (showOnlyCorrect) {\n legendItems.splice(1, 2);\n }\n\n return (\n <StyledFlexContainer>\n <StyledKey>{translator.t('selectText.key', { lng: language })}</StyledKey>\n {legendItems.map(({ Icon, label, Container }, idx) => (\n <Container key={idx}>\n <Icon />\n <span>{label}</span>\n </Container>\n ))}\n </StyledFlexContainer>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AAA6C,SAAAM,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,C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E;MAAEqE,GAAG,EAAEL;IAAS,CAAC,CAAC;IAC7EM,SAAS,EAAEnB;EACb,CAAC,CACF;EAED,IAAIc,eAAe,EAAE;IACnBC,WAAW,CAACK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;EAC1B;EAEA,oBACElF,MAAA,YAAAmF,aAAA,CAACpD,mBAAmB,qBAClB/B,MAAA,YAAAmF,aAAA,CAACtC,SAAS,QAAEhB,UAAU,CAAClB,CAAC,CAAC,gBAAgB,EAAE;IAAEqE,GAAG,EAAEL;EAAS,CAAC,CAAa,CAAC,EACzEE,WAAW,CAACO,GAAG,CAAC,UAAAC,KAAA,EAA6BC,GAAG;IAAA,IAA7BR,IAAI,GAAAO,KAAA,CAAJP,IAAI;MAAEC,KAAK,GAAAM,KAAA,CAALN,KAAK;MAAEE,SAAS,GAAAI,KAAA,CAATJ,SAAS;IAAA,oBACxCjF,MAAA,YAAAmF,aAAA,CAACF,SAAS;MAACM,GAAG,EAAED;IAAI,gBAClBtF,MAAA,YAAAmF,aAAA,CAACL,IAAI,MAAE,CAAC,eACR9E,MAAA,YAAAmF,aAAA,eAAOJ,KAAY,CACV,CAAC;EAAA,CACb,CACkB,CAAC;AAE1B,CAAC","ignoreList":[]}
|
|
@@ -18,10 +18,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
18
18
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
19
19
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
20
20
|
var _renderUi = require("@pie-lib/render-ui");
|
|
21
|
-
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; }
|
|
22
|
-
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; }
|
|
23
21
|
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)); }
|
|
24
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
25
|
// we need to use a larger line height for the token to be more readable
|
|
26
26
|
var LINE_HEIGHT_MULTIPLIER = 3.2;
|
|
27
27
|
// we need a bit more space for correctness indicators
|
|
@@ -39,7 +39,8 @@ var StyledToken = (0, _styles.styled)('span')(function (_ref) {
|
|
|
39
39
|
color: _renderUi.color.disabled()
|
|
40
40
|
},
|
|
41
41
|
'&.disabledBlack': {
|
|
42
|
-
cursor: 'inherit'
|
|
42
|
+
cursor: 'inherit',
|
|
43
|
+
pointerEvents: 'none'
|
|
43
44
|
},
|
|
44
45
|
'&.disabledAndSelected': {
|
|
45
46
|
backgroundColor: _renderUi.color.blueGrey100()
|
|
@@ -55,7 +56,7 @@ var StyledToken = (0, _styles.styled)('span')(function (_ref) {
|
|
|
55
56
|
}), '&.selected', {
|
|
56
57
|
backgroundColor: _renderUi.color.blueGrey100(),
|
|
57
58
|
color: theme.palette.common.black,
|
|
58
|
-
lineHeight: "".concat(theme.spacing(1) * LINE_HEIGHT_MULTIPLIER, "px"),
|
|
59
|
+
lineHeight: "".concat(parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER, "px"),
|
|
59
60
|
border: "solid 2px ".concat(_renderUi.color.blueGrey900()),
|
|
60
61
|
borderRadius: '4px',
|
|
61
62
|
'& > *': {
|
|
@@ -64,11 +65,11 @@ var StyledToken = (0, _styles.styled)('span')(function (_ref) {
|
|
|
64
65
|
}), '&.highlight', {
|
|
65
66
|
border: "dashed 2px ".concat(_renderUi.color.blueGrey600()),
|
|
66
67
|
borderRadius: '4px',
|
|
67
|
-
lineHeight: "".concat(theme.spacing(1) * LINE_HEIGHT_MULTIPLIER, "px")
|
|
68
|
+
lineHeight: "".concat(parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER, "px")
|
|
68
69
|
}), '&.print', {
|
|
69
70
|
border: "dashed 2px ".concat(_renderUi.color.blueGrey600()),
|
|
70
71
|
borderRadius: '4px',
|
|
71
|
-
lineHeight: "".concat(theme.spacing(1) * LINE_HEIGHT_MULTIPLIER, "px"),
|
|
72
|
+
lineHeight: "".concat(parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER, "px"),
|
|
72
73
|
color: _renderUi.color.text()
|
|
73
74
|
}), '&.custom', {
|
|
74
75
|
display: 'initial'
|
|
@@ -80,7 +81,7 @@ var StyledCommonTokenStyle = (0, _styles.styled)('span')(function (_ref3) {
|
|
|
80
81
|
position: 'relative',
|
|
81
82
|
borderRadius: '4px',
|
|
82
83
|
color: theme.palette.common.black,
|
|
83
|
-
lineHeight: "".concat(theme.spacing(1) * CORRECTNESS_LINE_HEIGHT_MULTIPLIER + CORRECTNESS_PADDING, "px"),
|
|
84
|
+
lineHeight: "".concat(parseFloat(theme.spacing(1)) * CORRECTNESS_LINE_HEIGHT_MULTIPLIER + CORRECTNESS_PADDING, "px"),
|
|
84
85
|
padding: "".concat(CORRECTNESS_PADDING, "px")
|
|
85
86
|
};
|
|
86
87
|
});
|
|
@@ -99,42 +100,36 @@ var StyledMissingContainer = (0, _styles.styled)(StyledCommonTokenStyle)(functio
|
|
|
99
100
|
border: "".concat(_renderUi.color.incorrectWithIcon(), " dashed 2px")
|
|
100
101
|
};
|
|
101
102
|
});
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
})
|
|
114
|
-
var StyledCorrectIcon = (0, _styles.styled)(StyledCorrectnessIcon)(function () {
|
|
115
|
-
return {
|
|
103
|
+
var baseIconStyles = {
|
|
104
|
+
color: _renderUi.color.white(),
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
top: '-8px',
|
|
107
|
+
left: '-8px',
|
|
108
|
+
borderRadius: '50%',
|
|
109
|
+
fontSize: '12px',
|
|
110
|
+
padding: '2px',
|
|
111
|
+
display: 'inline-block'
|
|
112
|
+
};
|
|
113
|
+
var StyledCorrectCheckIcon = (0, _styles.styled)(_Check["default"])(function () {
|
|
114
|
+
return _objectSpread(_objectSpread({}, baseIconStyles), {}, {
|
|
116
115
|
backgroundColor: _renderUi.color.correctTertiary()
|
|
117
|
-
};
|
|
116
|
+
});
|
|
118
117
|
});
|
|
119
|
-
var
|
|
120
|
-
return {
|
|
118
|
+
var StyledIncorrectCloseIcon = (0, _styles.styled)(_Close["default"])(function () {
|
|
119
|
+
return _objectSpread(_objectSpread({}, baseIconStyles), {}, {
|
|
121
120
|
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
122
|
-
};
|
|
121
|
+
});
|
|
123
122
|
});
|
|
124
123
|
var Wrapper = function Wrapper(_ref4) {
|
|
125
124
|
var useWrapper = _ref4.useWrapper,
|
|
126
125
|
children = _ref4.children,
|
|
127
126
|
Container = _ref4.Container,
|
|
128
|
-
IconComponent = _ref4.IconComponent,
|
|
129
127
|
Icon = _ref4.Icon;
|
|
130
|
-
return useWrapper ? /*#__PURE__*/_react["default"].createElement(Container, null, children, Icon
|
|
131
|
-
fontSize: "inherit"
|
|
132
|
-
})) : null) : children;
|
|
128
|
+
return useWrapper ? /*#__PURE__*/_react["default"].createElement(Container, null, children, Icon ? /*#__PURE__*/_react["default"].createElement(Icon, null) : null) : children;
|
|
133
129
|
};
|
|
134
130
|
Wrapper.propTypes = {
|
|
135
131
|
useWrapper: _propTypes["default"].bool,
|
|
136
132
|
Container: _propTypes["default"].elementType,
|
|
137
|
-
IconComponent: _propTypes["default"].elementType,
|
|
138
133
|
Icon: _propTypes["default"].elementType,
|
|
139
134
|
children: _propTypes["default"].node
|
|
140
135
|
};
|
|
@@ -164,7 +159,6 @@ var Token = exports.Token = /*#__PURE__*/function (_React$Component) {
|
|
|
164
159
|
var baseClassName = Token.rootClassName;
|
|
165
160
|
var Container;
|
|
166
161
|
var Icon;
|
|
167
|
-
var IconComponent;
|
|
168
162
|
if (correct === undefined && selected && disabled) {
|
|
169
163
|
return {
|
|
170
164
|
className: (0, _classnames["default"])(baseClassName, 'selected', 'disabledBlack', classNameProp),
|
|
@@ -177,8 +171,7 @@ var Token = exports.Token = /*#__PURE__*/function (_React$Component) {
|
|
|
177
171
|
className: (0, _classnames["default"])(baseClassName, 'custom', classNameProp),
|
|
178
172
|
Component: StyledToken,
|
|
179
173
|
Container: isCorrect ? StyledCorrectContainer : StyledIncorrectContainer,
|
|
180
|
-
Icon: isCorrect ?
|
|
181
|
-
IconComponent: isCorrect ? StyledCorrectIcon : StyledIncorrectIcon
|
|
174
|
+
Icon: isCorrect ? StyledCorrectCheckIcon : StyledIncorrectCloseIcon
|
|
182
175
|
};
|
|
183
176
|
}
|
|
184
177
|
if (isMissing) {
|
|
@@ -186,16 +179,14 @@ var Token = exports.Token = /*#__PURE__*/function (_React$Component) {
|
|
|
186
179
|
className: (0, _classnames["default"])(baseClassName, 'custom', 'missing', classNameProp),
|
|
187
180
|
Component: StyledToken,
|
|
188
181
|
Container: StyledMissingContainer,
|
|
189
|
-
Icon:
|
|
190
|
-
IconComponent: StyledIncorrectIcon
|
|
182
|
+
Icon: StyledIncorrectCloseIcon
|
|
191
183
|
};
|
|
192
184
|
}
|
|
193
185
|
return {
|
|
194
186
|
className: (0, _classnames["default"])(baseClassName, disabled && 'disabled', selectable && !disabled && !isTouchEnabled && 'selectable', selected && !disabled && 'selected', selected && disabled && 'disabledAndSelected', highlight && selectable && !disabled && !selected && 'highlight', animationsDisabled && 'print', classNameProp),
|
|
195
187
|
Component: StyledToken,
|
|
196
188
|
Container: Container,
|
|
197
|
-
Icon: Icon
|
|
198
|
-
IconComponent: IconComponent
|
|
189
|
+
Icon: Icon
|
|
199
190
|
};
|
|
200
191
|
});
|
|
201
192
|
return _this;
|
|
@@ -213,13 +204,11 @@ var Token = exports.Token = /*#__PURE__*/function (_React$Component) {
|
|
|
213
204
|
className = _this$getClassAndIcon.className,
|
|
214
205
|
Component = _this$getClassAndIcon.Component,
|
|
215
206
|
Container = _this$getClassAndIcon.Container,
|
|
216
|
-
Icon = _this$getClassAndIcon.Icon
|
|
217
|
-
IconComponent = _this$getClassAndIcon.IconComponent;
|
|
207
|
+
Icon = _this$getClassAndIcon.Icon;
|
|
218
208
|
var TokenComponent = Component || StyledToken;
|
|
219
209
|
return /*#__PURE__*/_react["default"].createElement(Wrapper, {
|
|
220
210
|
useWrapper: correct !== undefined || isMissing,
|
|
221
211
|
Container: Container,
|
|
222
|
-
IconComponent: IconComponent,
|
|
223
212
|
Icon: Icon
|
|
224
213
|
}, /*#__PURE__*/_react["default"].createElement(TokenComponent, {
|
|
225
214
|
className: className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_classnames","_Check","_Close","_renderUi","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","LINE_HEIGHT_MULTIPLIER","CORRECTNESS_LINE_HEIGHT_MULTIPLIER","CORRECTNESS_PADDING","StyledToken","styled","_ref","theme","cursor","textIndent","color","disabled","backgroundColor","blueGrey100","concat","breakpoints","values","md","blueGrey300","palette","common","black","lineHeight","spacing","border","blueGrey900","borderRadius","blueGrey600","text","display","StyledCommonTokenStyle","_ref3","position","padding","StyledCorrectContainer","correctTertiary","StyledIncorrectContainer","incorrectWithIcon","StyledMissingContainer","StyledCorrectnessIcon","white","top","left","fontSize","StyledCorrectIcon","StyledIncorrectIcon","Wrapper","_ref4","useWrapper","children","Container","IconComponent","Icon","createElement","propTypes","PropTypes","bool","elementType","node","TokenTypes","exports","string","selectable","Token","_React$Component","_this","_classCallCheck2","_len","args","Array","_key","_this$props","props","selected","classNameProp","className","highlight","correct","animationsDisabled","isMissing","isTouchEnabled","window","navigator","maxTouchPoints","msMaxTouchPoints","baseClassName","rootClassName","undefined","classNames","Component","isCorrect","Check","Close","_inherits2","_createClass2","key","value","render","_this$props2","index","_this$getClassAndIcon","getClassAndIconConfig","TokenComponent","dangerouslySetInnerHTML","__html","replace","React","isRequired","_default"],"sources":["../../src/token-select/token.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport classNames from 'classnames';\nimport Check from '@mui/icons-material/Check';\nimport Close from '@mui/icons-material/Close';\n\nimport { color } from '@pie-lib/render-ui';\n\n// we need to use a larger line height for the token to be more readable\nconst LINE_HEIGHT_MULTIPLIER = 3.2;\n// we need a bit more space for correctness indicators\nconst CORRECTNESS_LINE_HEIGHT_MULTIPLIER = 3.4;\nconst CORRECTNESS_PADDING = 2;\n\n// Styled components for different token states\nconst StyledToken = styled('span')(({ theme }) => ({\n cursor: 'pointer',\n textIndent: 0,\n '&.disabled': {\n cursor: 'inherit',\n color: color.disabled(),\n },\n '&.disabledBlack': {\n cursor: 'inherit',\n },\n '&.disabledAndSelected': {\n backgroundColor: color.blueGrey100(),\n },\n [`@media (min-width: ${theme.breakpoints.values.md}px)`]: {\n '&.selectable:hover': {\n backgroundColor: color.blueGrey300(),\n color: theme.palette.common.black,\n '& > *': {\n backgroundColor: color.blueGrey300(),\n },\n },\n },\n '&.selected': {\n backgroundColor: color.blueGrey100(),\n color: theme.palette.common.black,\n lineHeight: `${theme.spacing(1) * LINE_HEIGHT_MULTIPLIER}px`,\n border: `solid 2px ${color.blueGrey900()}`,\n borderRadius: '4px',\n '& > *': {\n backgroundColor: color.blueGrey100(),\n },\n },\n '&.highlight': {\n border: `dashed 2px ${color.blueGrey600()}`,\n borderRadius: '4px',\n lineHeight: `${theme.spacing(1) * LINE_HEIGHT_MULTIPLIER}px`,\n },\n '&.print': {\n border: `dashed 2px ${color.blueGrey600()}`,\n borderRadius: '4px',\n lineHeight: `${theme.spacing(1) * LINE_HEIGHT_MULTIPLIER}px`,\n color: color.text(),\n },\n '&.custom': {\n display: 'initial',\n },\n}));\n\nconst StyledCommonTokenStyle = styled('span')(({ theme }) => ({\n position: 'relative',\n borderRadius: '4px',\n color: theme.palette.common.black,\n lineHeight: `${theme.spacing(1) * CORRECTNESS_LINE_HEIGHT_MULTIPLIER + CORRECTNESS_PADDING}px`,\n padding: `${CORRECTNESS_PADDING}px`,\n}));\n\nconst StyledCorrectContainer = styled(StyledCommonTokenStyle)(() => ({\n border: `${color.correctTertiary()} solid 2px`,\n}));\n\nconst StyledIncorrectContainer = styled(StyledCommonTokenStyle)(() => ({\n border: `${color.incorrectWithIcon()} solid 2px`,\n}));\n\nconst StyledMissingContainer = styled(StyledCommonTokenStyle)(() => ({\n border: `${color.incorrectWithIcon()} dashed 2px`,\n}));\n\nconst StyledCorrectnessIcon = styled('span')(() => ({\n color: color.white(),\n position: 'absolute',\n top: '-8px',\n left: '-8px',\n borderRadius: '50%',\n fontSize: '12px',\n padding: '2px',\n display: 'inline-block',\n}));\n\nconst StyledCorrectIcon = styled(StyledCorrectnessIcon)(() => ({\n backgroundColor: color.correctTertiary(),\n}));\n\nconst StyledIncorrectIcon = styled(StyledCorrectnessIcon)(() => ({\n backgroundColor: color.incorrectWithIcon(),\n}));\n\nconst Wrapper = ({ useWrapper, children, Container, IconComponent, Icon }) =>\n useWrapper ? (\n <Container>\n {children}\n {Icon && IconComponent ? (\n <IconComponent>\n <Icon fontSize=\"inherit\" />\n </IconComponent>\n ) : null}\n </Container>\n ) : (\n children\n );\n\nWrapper.propTypes = {\n useWrapper: PropTypes.bool,\n Container: PropTypes.elementType,\n IconComponent: PropTypes.elementType,\n Icon: PropTypes.elementType,\n children: PropTypes.node,\n};\n\nexport const TokenTypes = {\n text: PropTypes.string,\n selectable: PropTypes.bool,\n};\n\nexport class Token extends React.Component {\n static rootClassName = 'tokenRootClass';\n\n static propTypes = {\n ...TokenTypes,\n text: PropTypes.string.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n highlight: PropTypes.bool,\n correct: PropTypes.bool,\n };\n\n static defaultProps = {\n selectable: false,\n text: '',\n };\n\n getClassAndIconConfig = () => {\n const {\n selectable,\n selected,\n className: classNameProp,\n disabled,\n highlight,\n correct,\n animationsDisabled,\n isMissing,\n } = this.props;\n const isTouchEnabled = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;\n const baseClassName = Token.rootClassName;\n let Container;\n let Icon;\n let IconComponent;\n\n if (correct === undefined && selected && disabled) {\n return {\n className: classNames(baseClassName, 'selected', 'disabledBlack', classNameProp),\n Component: StyledToken,\n };\n }\n\n if (correct !== undefined) {\n const isCorrect = correct === true;\n return {\n className: classNames(baseClassName, 'custom', classNameProp),\n Component: StyledToken,\n Container: isCorrect ? StyledCorrectContainer : StyledIncorrectContainer,\n Icon: isCorrect ? Check : Close,\n IconComponent: isCorrect ? StyledCorrectIcon : StyledIncorrectIcon,\n };\n }\n\n if (isMissing) {\n return {\n className: classNames(baseClassName, 'custom', 'missing', classNameProp),\n Component: StyledToken,\n Container: StyledMissingContainer,\n Icon: Close,\n IconComponent: StyledIncorrectIcon,\n };\n }\n\n return {\n className: classNames(\n baseClassName,\n disabled && 'disabled',\n selectable && !disabled && !isTouchEnabled && 'selectable',\n selected && !disabled && 'selected',\n selected && disabled && 'disabledAndSelected',\n highlight && selectable && !disabled && !selected && 'highlight',\n animationsDisabled && 'print',\n classNameProp,\n ),\n Component: StyledToken,\n Container,\n Icon,\n IconComponent,\n };\n };\n\n render() {\n const { text, index, correct, isMissing } = this.props;\n const { className, Component, Container, Icon, IconComponent } = this.getClassAndIconConfig();\n\n const TokenComponent = Component || StyledToken;\n\n return (\n <Wrapper\n useWrapper={correct !== undefined || isMissing}\n Container={Container}\n IconComponent={IconComponent}\n Icon={Icon}\n >\n <TokenComponent\n className={className}\n dangerouslySetInnerHTML={{ __html: (text || '').replace(/\\n/g, '<br>') }}\n data-indexkey={index}\n />\n </Wrapper>\n );\n }\n}\n\nexport default Token;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,SAAA,GAAAN,OAAA;AAA2C,S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AAE;AACR,CAAC;AAAA,IAAAgF,QAAA,GAAAhD,OAAA,cAwFYG,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"token.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_classnames","_Check","_Close","_renderUi","_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","LINE_HEIGHT_MULTIPLIER","CORRECTNESS_LINE_HEIGHT_MULTIPLIER","CORRECTNESS_PADDING","StyledToken","styled","_ref","theme","cursor","textIndent","color","disabled","pointerEvents","backgroundColor","blueGrey100","concat","breakpoints","values","md","blueGrey300","palette","common","black","lineHeight","parseFloat","spacing","border","blueGrey900","borderRadius","blueGrey600","text","display","StyledCommonTokenStyle","_ref3","position","padding","StyledCorrectContainer","correctTertiary","StyledIncorrectContainer","incorrectWithIcon","StyledMissingContainer","baseIconStyles","white","top","left","fontSize","StyledCorrectCheckIcon","Check","StyledIncorrectCloseIcon","Close","Wrapper","_ref4","useWrapper","children","Container","Icon","createElement","propTypes","PropTypes","bool","elementType","node","TokenTypes","exports","string","selectable","Token","_React$Component","_this","_classCallCheck2","_len","args","Array","_key","_this$props","props","selected","classNameProp","className","highlight","correct","animationsDisabled","isMissing","isTouchEnabled","window","navigator","maxTouchPoints","msMaxTouchPoints","baseClassName","rootClassName","undefined","classNames","Component","isCorrect","_inherits2","_createClass2","key","value","render","_this$props2","index","_this$getClassAndIcon","getClassAndIconConfig","TokenComponent","dangerouslySetInnerHTML","__html","replace","React","isRequired","_default"],"sources":["../../src/token-select/token.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport classNames from 'classnames';\nimport Check from '@mui/icons-material/Check';\nimport Close from '@mui/icons-material/Close';\n\nimport { color } from '@pie-lib/render-ui';\n\n// we need to use a larger line height for the token to be more readable\nconst LINE_HEIGHT_MULTIPLIER = 3.2;\n// we need a bit more space for correctness indicators\nconst CORRECTNESS_LINE_HEIGHT_MULTIPLIER = 3.4;\nconst CORRECTNESS_PADDING = 2;\n\n// Styled components for different token states\nconst StyledToken = styled('span')(({ theme }) => ({\n cursor: 'pointer',\n textIndent: 0,\n '&.disabled': {\n cursor: 'inherit',\n color: color.disabled(),\n },\n '&.disabledBlack': {\n cursor: 'inherit',\n pointerEvents: 'none',\n },\n '&.disabledAndSelected': {\n backgroundColor: color.blueGrey100(),\n },\n [`@media (min-width: ${theme.breakpoints.values.md}px)`]: {\n '&.selectable:hover': {\n backgroundColor: color.blueGrey300(),\n color: theme.palette.common.black,\n '& > *': {\n backgroundColor: color.blueGrey300(),\n },\n },\n },\n '&.selected': {\n backgroundColor: color.blueGrey100(),\n color: theme.palette.common.black,\n lineHeight: `${parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER}px`,\n border: `solid 2px ${color.blueGrey900()}`,\n borderRadius: '4px',\n '& > *': {\n backgroundColor: color.blueGrey100(),\n },\n },\n '&.highlight': {\n border: `dashed 2px ${color.blueGrey600()}`,\n borderRadius: '4px',\n lineHeight: `${parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER}px`,\n },\n '&.print': {\n border: `dashed 2px ${color.blueGrey600()}`,\n borderRadius: '4px',\n lineHeight: `${parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER}px`,\n color: color.text(),\n },\n '&.custom': {\n display: 'initial',\n },\n}));\n\nconst StyledCommonTokenStyle = styled('span')(({ theme }) => ({\n position: 'relative',\n borderRadius: '4px',\n color: theme.palette.common.black,\n lineHeight: `${parseFloat(theme.spacing(1)) * CORRECTNESS_LINE_HEIGHT_MULTIPLIER + CORRECTNESS_PADDING}px`,\n padding: `${CORRECTNESS_PADDING}px`,\n}));\n\nconst StyledCorrectContainer = styled(StyledCommonTokenStyle)(() => ({\n border: `${color.correctTertiary()} solid 2px`,\n}));\n\nconst StyledIncorrectContainer = styled(StyledCommonTokenStyle)(() => ({\n border: `${color.incorrectWithIcon()} solid 2px`,\n}));\n\nconst StyledMissingContainer = styled(StyledCommonTokenStyle)(() => ({\n border: `${color.incorrectWithIcon()} dashed 2px`,\n}));\n\nconst baseIconStyles = {\n color: color.white(),\n position: 'absolute',\n top: '-8px',\n left: '-8px',\n borderRadius: '50%',\n fontSize: '12px',\n padding: '2px',\n display: 'inline-block',\n};\n\nconst StyledCorrectCheckIcon = styled(Check)(() => ({\n ...baseIconStyles,\n backgroundColor: color.correctTertiary(),\n}));\n\nconst StyledIncorrectCloseIcon = styled(Close)(() => ({\n ...baseIconStyles,\n backgroundColor: color.incorrectWithIcon(),\n}));\n\nconst Wrapper = ({ useWrapper, children, Container, Icon }) =>\n useWrapper ? (\n <Container>\n {children}\n {Icon ? <Icon /> : null}\n </Container>\n ) : (\n children\n );\n\nWrapper.propTypes = {\n useWrapper: PropTypes.bool,\n Container: PropTypes.elementType,\n Icon: PropTypes.elementType,\n children: PropTypes.node,\n};\n\nexport const TokenTypes = {\n text: PropTypes.string,\n selectable: PropTypes.bool,\n};\n\nexport class Token extends React.Component {\n static rootClassName = 'tokenRootClass';\n\n static propTypes = {\n ...TokenTypes,\n text: PropTypes.string.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n highlight: PropTypes.bool,\n correct: PropTypes.bool,\n };\n\n static defaultProps = {\n selectable: false,\n text: '',\n };\n\n getClassAndIconConfig = () => {\n const {\n selectable,\n selected,\n className: classNameProp,\n disabled,\n highlight,\n correct,\n animationsDisabled,\n isMissing,\n } = this.props;\n const isTouchEnabled = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;\n const baseClassName = Token.rootClassName;\n let Container;\n let Icon;\n\n if (correct === undefined && selected && disabled) {\n return {\n className: classNames(baseClassName, 'selected', 'disabledBlack', classNameProp),\n Component: StyledToken,\n };\n }\n\n if (correct !== undefined) {\n const isCorrect = correct === true;\n return {\n className: classNames(baseClassName, 'custom', classNameProp),\n Component: StyledToken,\n Container: isCorrect ? StyledCorrectContainer : StyledIncorrectContainer,\n Icon: isCorrect ? StyledCorrectCheckIcon : StyledIncorrectCloseIcon,\n };\n }\n\n if (isMissing) {\n return {\n className: classNames(baseClassName, 'custom', 'missing', classNameProp),\n Component: StyledToken,\n Container: StyledMissingContainer,\n Icon: StyledIncorrectCloseIcon,\n };\n }\n\n return {\n className: classNames(\n baseClassName,\n disabled && 'disabled',\n selectable && !disabled && !isTouchEnabled && 'selectable',\n selected && !disabled && 'selected',\n selected && disabled && 'disabledAndSelected',\n highlight && selectable && !disabled && !selected && 'highlight',\n animationsDisabled && 'print',\n classNameProp,\n ),\n Component: StyledToken,\n Container,\n Icon,\n };\n };\n\n render() {\n const { text, index, correct, isMissing } = this.props;\n const { className, Component, Container, Icon } = this.getClassAndIconConfig();\n\n const TokenComponent = Component || StyledToken;\n\n return (\n <Wrapper\n useWrapper={correct !== undefined || isMissing}\n Container={Container}\n Icon={Icon}\n >\n <TokenComponent\n className={className}\n dangerouslySetInnerHTML={{ __html: (text || '').replace(/\\n/g, '<br>') }}\n data-indexkey={index}\n />\n </Wrapper>\n );\n }\n}\n\nexport default Token;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,SAAA,GAAAN,OAAA;AAA2C,SAAAO,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAA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AAW;MAE/C,oBACE5C,MAAA,YAAAgG,aAAA,CAACN,OAAO;QACNE,UAAU,EAAE4B,OAAO,KAAKU,SAAS,IAAIR,SAAU;QAC/C5B,SAAS,EAAEA,SAAU;QACrBC,IAAI,EAAEA;MAAK,gBAEX/F,MAAA,YAAAgG,aAAA,CAAC+C,cAAc;QACbzB,SAAS,EAAEA,SAAU;QACrB0B,uBAAuB,EAAE;UAAEC,MAAM,EAAE,CAAC3E,IAAI,IAAI,EAAE,EAAE4E,OAAO,CAAC,KAAK,EAAE,MAAM;QAAE,CAAE;QACzE,iBAAeN;MAAM,CACtB,CACM,CAAC;IAEd;EAAC;AAAA,EA/FwBO,iBAAK,CAACf,SAAS;AAAA,IAAA/F,gBAAA,aAA7BqE,KAAK,mBACO,gBAAgB;AAAA,IAAArE,gBAAA,aAD5BqE,KAAK,eAAAzE,aAAA,CAAAA,aAAA,KAIXqE,UAAU;EACbhC,IAAI,EAAE4B,qBAAS,CAACM,MAAM,CAAC4C,UAAU;EACjC9B,SAAS,EAAEpB,qBAAS,CAACM,MAAM;EAC3BrD,QAAQ,EAAE+C,qBAAS,CAACC,IAAI;EACxBoB,SAAS,EAAErB,qBAAS,CAACC,IAAI;EACzBqB,OAAO,EAAEtB,qBAAS,CAACC;AAAI;AAAA,IAAA9D,gBAAA,aATdqE,KAAK,kBAYM;EACpBD,UAAU,EAAE,KAAK;EACjBnC,IAAI,EAAE;AACR,CAAC;AAAA,IAAA+E,QAAA,GAAA9C,OAAA,cAmFYG,KAAK","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.40.0-mui-update.0",
|
|
7
7
|
"description": "Some react components for text selection",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"@mui/icons-material": "^7.3.4",
|
|
23
23
|
"@mui/material": "^7.3.4",
|
|
24
24
|
"@pie-framework/parse-english": "^1.0.0",
|
|
25
|
-
"@pie-lib/render-ui": "4.
|
|
26
|
-
"@pie-lib/style-utils": "0.
|
|
27
|
-
"@pie-lib/translator": "2.
|
|
25
|
+
"@pie-lib/render-ui": "4.43.0-mui-update.0",
|
|
26
|
+
"@pie-lib/style-utils": "0.29.0-mui-update.0",
|
|
27
|
+
"@pie-lib/translator": "2.32.0-mui-update.0",
|
|
28
28
|
"classnames": "^2.2.6",
|
|
29
29
|
"debug": "^4.1.1",
|
|
30
30
|
"invariant": "^2.2.4",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@pie-framework/parse-english": "^1.0.0",
|
|
37
|
-
"@pie-lib/test-utils": "0.
|
|
37
|
+
"@pie-lib/test-utils": "0.30.0-mui-update.0",
|
|
38
38
|
"natural": "^0.6.3",
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-dom": "^18.2.0"
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "^18.2.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "094026045c44d3d7e558beb7e6986f2652661f75",
|
|
46
46
|
"scripts": {}
|
|
47
47
|
}
|
package/src/legend.js
CHANGED
|
@@ -45,7 +45,7 @@ const StyledMissingContainer = styled(StyledContainer)(() => ({
|
|
|
45
45
|
border: `${color.incorrectWithIcon()} dashed 2px`,
|
|
46
46
|
}));
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const baseIconStyles = {
|
|
49
49
|
color: color.white(),
|
|
50
50
|
position: 'absolute',
|
|
51
51
|
top: '-8px',
|
|
@@ -53,35 +53,34 @@ const StyledIcon = styled('div')(() => ({
|
|
|
53
53
|
borderRadius: '50%',
|
|
54
54
|
fontSize: '12px',
|
|
55
55
|
padding: '2px',
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
|
|
58
|
-
const
|
|
58
|
+
const StyledCorrectCheckIcon = styled(Check)(() => ({
|
|
59
|
+
...baseIconStyles,
|
|
59
60
|
backgroundColor: color.correctTertiary(),
|
|
60
61
|
}));
|
|
61
62
|
|
|
62
|
-
const
|
|
63
|
+
const StyledIncorrectCloseIcon = styled(Close)(() => ({
|
|
64
|
+
...baseIconStyles,
|
|
63
65
|
backgroundColor: color.incorrectWithIcon(),
|
|
64
66
|
}));
|
|
65
67
|
|
|
66
68
|
export const Legend = ({ language, showOnlyCorrect }) => {
|
|
67
69
|
const legendItems = [
|
|
68
70
|
{
|
|
69
|
-
Icon:
|
|
71
|
+
Icon: StyledCorrectCheckIcon,
|
|
70
72
|
label: translator.t('selectText.correctAnswerSelected', { lng: language }),
|
|
71
73
|
Container: StyledCorrectContainer,
|
|
72
|
-
IconComponent: StyledCorrectIcon,
|
|
73
74
|
},
|
|
74
75
|
{
|
|
75
|
-
Icon:
|
|
76
|
+
Icon: StyledIncorrectCloseIcon,
|
|
76
77
|
label: translator.t('selectText.incorrectSelection', { lng: language }),
|
|
77
78
|
Container: StyledIncorrectContainer,
|
|
78
|
-
IconComponent: StyledIncorrectIcon,
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
Icon:
|
|
81
|
+
Icon: StyledIncorrectCloseIcon,
|
|
82
82
|
label: translator.t('selectText.correctAnswerNotSelected', { lng: language }),
|
|
83
83
|
Container: StyledMissingContainer,
|
|
84
|
-
IconComponent: StyledIncorrectIcon,
|
|
85
84
|
},
|
|
86
85
|
];
|
|
87
86
|
|
|
@@ -92,11 +91,9 @@ export const Legend = ({ language, showOnlyCorrect }) => {
|
|
|
92
91
|
return (
|
|
93
92
|
<StyledFlexContainer>
|
|
94
93
|
<StyledKey>{translator.t('selectText.key', { lng: language })}</StyledKey>
|
|
95
|
-
{legendItems.map(({ Icon, label, Container
|
|
94
|
+
{legendItems.map(({ Icon, label, Container }, idx) => (
|
|
96
95
|
<Container key={idx}>
|
|
97
|
-
<
|
|
98
|
-
<Icon />
|
|
99
|
-
</IconComponent>
|
|
96
|
+
<Icon />
|
|
100
97
|
<span>{label}</span>
|
|
101
98
|
</Container>
|
|
102
99
|
))}
|
|
@@ -23,6 +23,7 @@ const StyledToken = styled('span')(({ theme }) => ({
|
|
|
23
23
|
},
|
|
24
24
|
'&.disabledBlack': {
|
|
25
25
|
cursor: 'inherit',
|
|
26
|
+
pointerEvents: 'none',
|
|
26
27
|
},
|
|
27
28
|
'&.disabledAndSelected': {
|
|
28
29
|
backgroundColor: color.blueGrey100(),
|
|
@@ -39,7 +40,7 @@ const StyledToken = styled('span')(({ theme }) => ({
|
|
|
39
40
|
'&.selected': {
|
|
40
41
|
backgroundColor: color.blueGrey100(),
|
|
41
42
|
color: theme.palette.common.black,
|
|
42
|
-
lineHeight: `${theme.spacing(1) * LINE_HEIGHT_MULTIPLIER}px`,
|
|
43
|
+
lineHeight: `${parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER}px`,
|
|
43
44
|
border: `solid 2px ${color.blueGrey900()}`,
|
|
44
45
|
borderRadius: '4px',
|
|
45
46
|
'& > *': {
|
|
@@ -49,12 +50,12 @@ const StyledToken = styled('span')(({ theme }) => ({
|
|
|
49
50
|
'&.highlight': {
|
|
50
51
|
border: `dashed 2px ${color.blueGrey600()}`,
|
|
51
52
|
borderRadius: '4px',
|
|
52
|
-
lineHeight: `${theme.spacing(1) * LINE_HEIGHT_MULTIPLIER}px`,
|
|
53
|
+
lineHeight: `${parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER}px`,
|
|
53
54
|
},
|
|
54
55
|
'&.print': {
|
|
55
56
|
border: `dashed 2px ${color.blueGrey600()}`,
|
|
56
57
|
borderRadius: '4px',
|
|
57
|
-
lineHeight: `${theme.spacing(1) * LINE_HEIGHT_MULTIPLIER}px`,
|
|
58
|
+
lineHeight: `${parseFloat(theme.spacing(1)) * LINE_HEIGHT_MULTIPLIER}px`,
|
|
58
59
|
color: color.text(),
|
|
59
60
|
},
|
|
60
61
|
'&.custom': {
|
|
@@ -66,7 +67,7 @@ const StyledCommonTokenStyle = styled('span')(({ theme }) => ({
|
|
|
66
67
|
position: 'relative',
|
|
67
68
|
borderRadius: '4px',
|
|
68
69
|
color: theme.palette.common.black,
|
|
69
|
-
lineHeight: `${theme.spacing(1) * CORRECTNESS_LINE_HEIGHT_MULTIPLIER + CORRECTNESS_PADDING}px`,
|
|
70
|
+
lineHeight: `${parseFloat(theme.spacing(1)) * CORRECTNESS_LINE_HEIGHT_MULTIPLIER + CORRECTNESS_PADDING}px`,
|
|
70
71
|
padding: `${CORRECTNESS_PADDING}px`,
|
|
71
72
|
}));
|
|
72
73
|
|
|
@@ -82,7 +83,7 @@ const StyledMissingContainer = styled(StyledCommonTokenStyle)(() => ({
|
|
|
82
83
|
border: `${color.incorrectWithIcon()} dashed 2px`,
|
|
83
84
|
}));
|
|
84
85
|
|
|
85
|
-
const
|
|
86
|
+
const baseIconStyles = {
|
|
86
87
|
color: color.white(),
|
|
87
88
|
position: 'absolute',
|
|
88
89
|
top: '-8px',
|
|
@@ -91,25 +92,23 @@ const StyledCorrectnessIcon = styled('span')(() => ({
|
|
|
91
92
|
fontSize: '12px',
|
|
92
93
|
padding: '2px',
|
|
93
94
|
display: 'inline-block',
|
|
94
|
-
}
|
|
95
|
+
};
|
|
95
96
|
|
|
96
|
-
const
|
|
97
|
+
const StyledCorrectCheckIcon = styled(Check)(() => ({
|
|
98
|
+
...baseIconStyles,
|
|
97
99
|
backgroundColor: color.correctTertiary(),
|
|
98
100
|
}));
|
|
99
101
|
|
|
100
|
-
const
|
|
102
|
+
const StyledIncorrectCloseIcon = styled(Close)(() => ({
|
|
103
|
+
...baseIconStyles,
|
|
101
104
|
backgroundColor: color.incorrectWithIcon(),
|
|
102
105
|
}));
|
|
103
106
|
|
|
104
|
-
const Wrapper = ({ useWrapper, children, Container,
|
|
107
|
+
const Wrapper = ({ useWrapper, children, Container, Icon }) =>
|
|
105
108
|
useWrapper ? (
|
|
106
109
|
<Container>
|
|
107
110
|
{children}
|
|
108
|
-
{Icon
|
|
109
|
-
<IconComponent>
|
|
110
|
-
<Icon fontSize="inherit" />
|
|
111
|
-
</IconComponent>
|
|
112
|
-
) : null}
|
|
111
|
+
{Icon ? <Icon /> : null}
|
|
113
112
|
</Container>
|
|
114
113
|
) : (
|
|
115
114
|
children
|
|
@@ -118,7 +117,6 @@ const Wrapper = ({ useWrapper, children, Container, IconComponent, Icon }) =>
|
|
|
118
117
|
Wrapper.propTypes = {
|
|
119
118
|
useWrapper: PropTypes.bool,
|
|
120
119
|
Container: PropTypes.elementType,
|
|
121
|
-
IconComponent: PropTypes.elementType,
|
|
122
120
|
Icon: PropTypes.elementType,
|
|
123
121
|
children: PropTypes.node,
|
|
124
122
|
};
|
|
@@ -160,7 +158,6 @@ export class Token extends React.Component {
|
|
|
160
158
|
const baseClassName = Token.rootClassName;
|
|
161
159
|
let Container;
|
|
162
160
|
let Icon;
|
|
163
|
-
let IconComponent;
|
|
164
161
|
|
|
165
162
|
if (correct === undefined && selected && disabled) {
|
|
166
163
|
return {
|
|
@@ -175,8 +172,7 @@ export class Token extends React.Component {
|
|
|
175
172
|
className: classNames(baseClassName, 'custom', classNameProp),
|
|
176
173
|
Component: StyledToken,
|
|
177
174
|
Container: isCorrect ? StyledCorrectContainer : StyledIncorrectContainer,
|
|
178
|
-
Icon: isCorrect ?
|
|
179
|
-
IconComponent: isCorrect ? StyledCorrectIcon : StyledIncorrectIcon,
|
|
175
|
+
Icon: isCorrect ? StyledCorrectCheckIcon : StyledIncorrectCloseIcon,
|
|
180
176
|
};
|
|
181
177
|
}
|
|
182
178
|
|
|
@@ -185,8 +181,7 @@ export class Token extends React.Component {
|
|
|
185
181
|
className: classNames(baseClassName, 'custom', 'missing', classNameProp),
|
|
186
182
|
Component: StyledToken,
|
|
187
183
|
Container: StyledMissingContainer,
|
|
188
|
-
Icon:
|
|
189
|
-
IconComponent: StyledIncorrectIcon,
|
|
184
|
+
Icon: StyledIncorrectCloseIcon,
|
|
190
185
|
};
|
|
191
186
|
}
|
|
192
187
|
|
|
@@ -204,13 +199,12 @@ export class Token extends React.Component {
|
|
|
204
199
|
Component: StyledToken,
|
|
205
200
|
Container,
|
|
206
201
|
Icon,
|
|
207
|
-
IconComponent,
|
|
208
202
|
};
|
|
209
203
|
};
|
|
210
204
|
|
|
211
205
|
render() {
|
|
212
206
|
const { text, index, correct, isMissing } = this.props;
|
|
213
|
-
const { className, Component, Container, Icon
|
|
207
|
+
const { className, Component, Container, Icon } = this.getClassAndIconConfig();
|
|
214
208
|
|
|
215
209
|
const TokenComponent = Component || StyledToken;
|
|
216
210
|
|
|
@@ -218,7 +212,6 @@ export class Token extends React.Component {
|
|
|
218
212
|
<Wrapper
|
|
219
213
|
useWrapper={correct !== undefined || isMissing}
|
|
220
214
|
Container={Container}
|
|
221
|
-
IconComponent={IconComponent}
|
|
222
215
|
Icon={Icon}
|
|
223
216
|
>
|
|
224
217
|
<TokenComponent
|