@pie-lib/text-select 1.32.3-next.0 → 1.32.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 +15 -67
- package/esm/package.json +3 -0
- package/lib/index.js +1 -12
- package/lib/index.js.map +1 -1
- package/lib/legend.js +87 -94
- package/lib/legend.js.map +1 -1
- package/lib/text-select.js +18 -51
- package/lib/text-select.js.map +1 -1
- package/lib/token-select/index.js +85 -128
- package/lib/token-select/index.js.map +1 -1
- package/lib/token-select/token.js +152 -192
- package/lib/token-select/token.js.map +1 -1
- package/lib/tokenizer/builder.js +23 -68
- package/lib/tokenizer/builder.js.map +1 -1
- package/lib/tokenizer/controls.js +50 -81
- package/lib/tokenizer/controls.js.map +1 -1
- package/lib/tokenizer/index.js +32 -88
- package/lib/tokenizer/index.js.map +1 -1
- package/lib/tokenizer/selection-utils.js +2 -12
- package/lib/tokenizer/selection-utils.js.map +1 -1
- package/lib/tokenizer/token-text.js +45 -78
- package/lib/tokenizer/token-text.js.map +1 -1
- package/lib/utils.js +8 -24
- package/lib/utils.js.map +1 -1
- package/package.json +23 -16
- package/src/__tests__/text-select.test.jsx +33 -23
- package/src/legend.js +76 -70
- package/src/token-select/__tests__/index.test.jsx +110 -242
- package/src/token-select/__tests__/token.test.jsx +21 -24
- package/src/token-select/index.jsx +73 -66
- package/src/token-select/token.jsx +126 -124
- package/src/tokenizer/__tests__/controls.test.jsx +20 -18
- package/src/tokenizer/__tests__/index.test.jsx +27 -120
- package/src/tokenizer/__tests__/token-text.test.jsx +23 -117
- package/src/tokenizer/controls.jsx +40 -42
- package/src/tokenizer/index.jsx +15 -18
- package/src/tokenizer/token-text.jsx +12 -10
- package/src/__tests__/__snapshots__/text-select.test.jsx.snap +0 -21
- package/src/token-select/__tests__/__snapshots__/index.test.jsx.snap +0 -49
- package/src/token-select/__tests__/__snapshots__/token.test.jsx.snap +0 -27
- package/src/tokenizer/__tests__/__snapshots__/controls.test.jsx.snap +0 -59
- package/src/tokenizer/__tests__/__snapshots__/index.test.jsx.snap +0 -31
- package/src/tokenizer/__tests__/__snapshots__/token-text.test.jsx.snap +0 -17
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
|
+
# [2.0.0-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.32.3-next.0...@pie-lib/text-select@2.0.0-next.0) (2026-01-19)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
## [1.32.
|
|
14
|
+
## [1.32.3-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.46.0-mui-update.0...@pie-lib/text-select@1.32.3-next.0) (2026-01-19)
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
### Bug Fixes
|
|
@@ -22,141 +22,89 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## [1.32.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.32.1...@pie-lib/text-select@1.32.2) (2025-11-27)
|
|
26
26
|
|
|
27
27
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
28
28
|
|
|
29
|
+
## [1.32.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.2...@pie-lib/text-select@1.32.1) (2025-10-22)
|
|
29
30
|
|
|
31
|
+
### Bug Fixes
|
|
30
32
|
|
|
33
|
+
- bump config-ui PD-5265 ([77d0c78](https://github.com/pie-framework/pie-lib/commit/77d0c78cacfa57e93ed17e7a7f1257f4a9cf6ab3))
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
# [1.31.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.0...@pie-lib/text-select@1.31.0) (2025-10-16)
|
|
35
|
+
# [1.32.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.31.0...@pie-lib/text-select@1.32.0) (2025-10-16)
|
|
34
36
|
|
|
35
37
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
36
38
|
|
|
39
|
+
# [1.31.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.0...@pie-lib/text-select@1.31.0) (2025-10-16)
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
40
42
|
|
|
41
43
|
# [1.30.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.0...@pie-lib/text-select@1.30.0) (2025-10-16)
|
|
42
44
|
|
|
43
45
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
47
|
# [1.29.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.0...@pie-lib/text-select@1.29.0) (2025-10-16)
|
|
50
48
|
|
|
51
49
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
51
|
## [1.28.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.1...@pie-lib/text-select@1.28.2) (2025-10-14)
|
|
58
52
|
|
|
59
53
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
55
|
## [1.28.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.28.0...@pie-lib/text-select@1.28.1) (2025-10-09)
|
|
66
56
|
|
|
67
57
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
59
|
# [1.28.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.12.7...@pie-lib/text-select@1.28.0) (2025-09-25)
|
|
74
60
|
|
|
75
|
-
|
|
76
61
|
### Bug Fixes
|
|
77
62
|
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
80
64
|
|
|
81
65
|
### Features
|
|
82
66
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
67
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
88
68
|
|
|
89
69
|
# [1.27.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.26.0...@pie-lib/text-select@1.27.0) (2025-09-18)
|
|
90
70
|
|
|
91
71
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
92
72
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
73
|
# [1.26.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.25.0...@pie-lib/text-select@1.26.0) (2025-09-18)
|
|
98
74
|
|
|
99
75
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
100
76
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
77
|
# [1.25.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.12.7...@pie-lib/text-select@1.25.0) (2025-09-18)
|
|
106
78
|
|
|
107
|
-
|
|
108
79
|
### Bug Fixes
|
|
109
80
|
|
|
110
|
-
|
|
111
|
-
|
|
81
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
112
82
|
|
|
113
83
|
### Features
|
|
114
84
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
85
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
120
86
|
|
|
121
87
|
# [1.24.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.23.0...@pie-lib/text-select@1.24.0) (2025-09-17)
|
|
122
88
|
|
|
123
89
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
124
90
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
91
|
# [1.23.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.22.0...@pie-lib/text-select@1.23.0) (2025-09-17)
|
|
130
92
|
|
|
131
93
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
132
94
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
95
|
# [1.22.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.21.1...@pie-lib/text-select@1.22.0) (2025-09-17)
|
|
138
96
|
|
|
139
97
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
140
98
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
99
|
## [1.21.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.12.7...@pie-lib/text-select@1.21.1) (2025-08-11)
|
|
146
100
|
|
|
147
|
-
|
|
148
101
|
### Bug Fixes
|
|
149
102
|
|
|
150
|
-
|
|
151
|
-
|
|
103
|
+
- fixed pie-lib/icons import [PD-5126](<[dcb506c](https://github.com/pie-framework/pie-lib/commit/dcb506c914a177f6d88bf73247a023bfe71dac1f)>)
|
|
152
104
|
|
|
153
105
|
### Features
|
|
154
106
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
107
|
+
- split pie-toolbox into multiple packages [PD-5126](<[7d55a25](https://github.com/pie-framework/pie-lib/commit/7d55a2552d084cd3d0d5c00dc77411b2ced2f5e2)>)
|
|
160
108
|
|
|
161
109
|
# [1.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.12.7...@pie-lib/text-select@1.21.0) (2025-08-07)
|
|
162
110
|
|
package/esm/package.json
ADDED
package/lib/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -49,20 +47,11 @@ Object.defineProperty(exports, "prepareText", {
|
|
|
49
47
|
return _utils.prepareText;
|
|
50
48
|
}
|
|
51
49
|
});
|
|
52
|
-
|
|
53
50
|
var _tokenizer = _interopRequireDefault(require("./tokenizer"));
|
|
54
|
-
|
|
55
51
|
var _tokenSelect = _interopRequireWildcard(require("./token-select"));
|
|
56
|
-
|
|
57
52
|
var _textSelect = _interopRequireDefault(require("./text-select"));
|
|
58
|
-
|
|
59
53
|
var _legend = require("./legend");
|
|
60
|
-
|
|
61
54
|
var _token = _interopRequireDefault(require("./token-select/token"));
|
|
62
|
-
|
|
63
55
|
var _utils = require("./utils");
|
|
64
|
-
|
|
65
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
66
|
-
|
|
67
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
56
|
+
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); }
|
|
68
57
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_tokenizer","_interopRequireDefault","require","_tokenSelect","_interopRequireWildcard","_textSelect","_legend","_token","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../src/index.js"],"sourcesContent":["import Tokenizer from './tokenizer';\nimport TokenSelect, { TokenTypes } from './token-select';\nimport TextSelect from './text-select';\nimport { Legend } from './legend';\nimport Token from './token-select/token';\nimport { prepareText } from './utils';\n\nexport { TextSelect, TokenTypes, Tokenizer, TokenSelect, Token, prepareText, Legend };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAsC,SAAAE,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAnB,CAAA,EAAAc,EAAA,OAAAP,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAM,EAAA,EAAAP,CAAA,IAAAC,CAAA,CAAAM,EAAA,IAAAd,CAAA,CAAAc,EAAA,WAAAN,CAAA,KAAAR,CAAA,EAAAC,CAAA","ignoreList":[]}
|
package/lib/legend.js
CHANGED
|
@@ -1,126 +1,119 @@
|
|
|
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.Legend = void 0;
|
|
9
|
-
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _Check = _interopRequireDefault(require("@material-ui/icons/Check"));
|
|
15
|
-
|
|
16
|
-
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
17
|
-
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
12
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
18
13
|
var _renderUi = require("@pie-lib/render-ui");
|
|
19
|
-
|
|
20
14
|
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
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; }
|
|
24
17
|
var translator = _translator["default"].translator;
|
|
25
|
-
var
|
|
18
|
+
var StyledFlexContainer = (0, _styles.styled)('div')(function (_ref) {
|
|
19
|
+
var theme = _ref.theme;
|
|
20
|
+
return {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
gap: theme.spacing(2),
|
|
25
|
+
borderBottom: '1px solid lightgrey',
|
|
26
|
+
borderTop: '1px solid lightgrey',
|
|
27
|
+
paddingBottom: theme.spacing(1),
|
|
28
|
+
paddingTop: theme.spacing(1),
|
|
29
|
+
marginBottom: theme.spacing(1)
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
var StyledKey = (0, _styles.styled)('span')(function (_ref2) {
|
|
33
|
+
var theme = _ref2.theme;
|
|
34
|
+
return {
|
|
35
|
+
fontSize: '14px',
|
|
36
|
+
fontWeight: 'bold',
|
|
37
|
+
color: _renderUi.color.black(),
|
|
38
|
+
marginLeft: theme.spacing(1)
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
var StyledContainer = (0, _styles.styled)('div')(function () {
|
|
26
42
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
gap: "".concat(2 * theme.spacing.unit, "px"),
|
|
32
|
-
borderBottom: '1px solid lightgrey',
|
|
33
|
-
borderTop: '1px solid lightgrey',
|
|
34
|
-
paddingBottom: theme.spacing.unit,
|
|
35
|
-
paddingTop: theme.spacing.unit,
|
|
36
|
-
marginBottom: theme.spacing.unit
|
|
37
|
-
},
|
|
38
|
-
key: {
|
|
39
|
-
fontSize: '14px',
|
|
40
|
-
fontWeight: 'bold',
|
|
41
|
-
color: _renderUi.color.black(),
|
|
42
|
-
marginLeft: theme.spacing.unit
|
|
43
|
-
},
|
|
44
|
-
container: {
|
|
45
|
-
position: 'relative',
|
|
46
|
-
padding: '4px',
|
|
47
|
-
fontSize: '14px',
|
|
48
|
-
borderRadius: '4px'
|
|
49
|
-
},
|
|
50
|
-
correct: {
|
|
51
|
-
border: "".concat(_renderUi.color.correctTertiary(), " solid 2px")
|
|
52
|
-
},
|
|
53
|
-
incorrect: {
|
|
54
|
-
border: "".concat(_renderUi.color.incorrectWithIcon(), " solid 2px")
|
|
55
|
-
},
|
|
56
|
-
missing: {
|
|
57
|
-
border: "".concat(_renderUi.color.incorrectWithIcon(), " dashed 2px")
|
|
58
|
-
},
|
|
59
|
-
incorrectIcon: {
|
|
60
|
-
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
61
|
-
},
|
|
62
|
-
correctIcon: {
|
|
63
|
-
backgroundColor: _renderUi.color.correctTertiary()
|
|
64
|
-
},
|
|
65
|
-
icon: {
|
|
66
|
-
color: _renderUi.color.white(),
|
|
67
|
-
position: 'absolute',
|
|
68
|
-
top: '-8px',
|
|
69
|
-
left: '-8px',
|
|
70
|
-
borderRadius: '50%',
|
|
71
|
-
fontSize: '12px',
|
|
72
|
-
padding: '2px'
|
|
73
|
-
}
|
|
43
|
+
position: 'relative',
|
|
44
|
+
padding: '4px',
|
|
45
|
+
fontSize: '14px',
|
|
46
|
+
borderRadius: '4px'
|
|
74
47
|
};
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
});
|
|
49
|
+
var StyledCorrectContainer = (0, _styles.styled)(StyledContainer)(function () {
|
|
50
|
+
return {
|
|
51
|
+
border: "".concat(_renderUi.color.correctTertiary(), " solid 2px")
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
var StyledIncorrectContainer = (0, _styles.styled)(StyledContainer)(function () {
|
|
55
|
+
return {
|
|
56
|
+
border: "".concat(_renderUi.color.incorrectWithIcon(), " solid 2px")
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
var StyledMissingContainer = (0, _styles.styled)(StyledContainer)(function () {
|
|
60
|
+
return {
|
|
61
|
+
border: "".concat(_renderUi.color.incorrectWithIcon(), " dashed 2px")
|
|
62
|
+
};
|
|
63
|
+
});
|
|
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), {}, {
|
|
75
|
+
backgroundColor: _renderUi.color.correctTertiary()
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
var StyledIncorrectCloseIcon = (0, _styles.styled)(_Close["default"])(function () {
|
|
79
|
+
return _objectSpread(_objectSpread({}, baseIconStyles), {}, {
|
|
80
|
+
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var Legend = exports.Legend = function Legend(_ref3) {
|
|
84
|
+
var language = _ref3.language,
|
|
85
|
+
showOnlyCorrect = _ref3.showOnlyCorrect;
|
|
79
86
|
var legendItems = [{
|
|
80
|
-
Icon:
|
|
87
|
+
Icon: StyledCorrectCheckIcon,
|
|
81
88
|
label: translator.t('selectText.correctAnswerSelected', {
|
|
82
89
|
lng: language
|
|
83
90
|
}),
|
|
84
|
-
|
|
85
|
-
iconClass: (0, _classnames["default"])(classes.correctIcon, classes.icon)
|
|
91
|
+
Container: StyledCorrectContainer
|
|
86
92
|
}, {
|
|
87
|
-
Icon:
|
|
93
|
+
Icon: StyledIncorrectCloseIcon,
|
|
88
94
|
label: translator.t('selectText.incorrectSelection', {
|
|
89
95
|
lng: language
|
|
90
96
|
}),
|
|
91
|
-
|
|
92
|
-
iconClass: (0, _classnames["default"])(classes.incorrectIcon, classes.icon)
|
|
97
|
+
Container: StyledIncorrectContainer
|
|
93
98
|
}, {
|
|
94
|
-
Icon:
|
|
99
|
+
Icon: StyledIncorrectCloseIcon,
|
|
95
100
|
label: translator.t('selectText.correctAnswerNotSelected', {
|
|
96
101
|
lng: language
|
|
97
102
|
}),
|
|
98
|
-
|
|
99
|
-
iconClass: (0, _classnames["default"])(classes.incorrectIcon, classes.icon)
|
|
103
|
+
Container: StyledMissingContainer
|
|
100
104
|
}];
|
|
101
|
-
|
|
102
105
|
if (showOnlyCorrect) {
|
|
103
106
|
legendItems.splice(1, 2);
|
|
104
107
|
}
|
|
105
|
-
|
|
106
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
|
-
className: classes.flexContainer
|
|
108
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
109
|
-
className: classes.key
|
|
110
|
-
}, translator.t('selectText.key', {
|
|
108
|
+
return /*#__PURE__*/_react["default"].createElement(StyledFlexContainer, null, /*#__PURE__*/_react["default"].createElement(StyledKey, null, translator.t('selectText.key', {
|
|
111
109
|
lng: language
|
|
112
|
-
})), legendItems.map(function (
|
|
113
|
-
var Icon =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
className: containerClass
|
|
120
|
-
}, /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
121
|
-
className: iconClass
|
|
122
|
-
}), /*#__PURE__*/_react["default"].createElement("span", null, label));
|
|
110
|
+
})), legendItems.map(function (_ref4, idx) {
|
|
111
|
+
var Icon = _ref4.Icon,
|
|
112
|
+
label = _ref4.label,
|
|
113
|
+
Container = _ref4.Container;
|
|
114
|
+
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
115
|
+
key: idx
|
|
116
|
+
}, /*#__PURE__*/_react["default"].createElement(Icon, null), /*#__PURE__*/_react["default"].createElement("span", null, label));
|
|
123
117
|
}));
|
|
124
|
-
}
|
|
125
|
-
exports.Legend = Legend;
|
|
118
|
+
};
|
|
126
119
|
//# sourceMappingURL=legend.js.map
|
package/lib/legend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,G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zB;EACb,CAAC,EACD;IACEsB,IAAI,EAAER,wBAAwB;IAC9BS,KAAK,EAAElD,UAAU,CAAClB,CAAC,CAAC,+BAA+B,EAAE;MAAEqE,GAAG,EAAEL;IAAS,CAAC,CAAC;IACvEM,SAAS,EAAErB;EACb,CAAC,EACD;IACEkB,IAAI,EAAER,wBAAwB;IAC9BS,KAAK,EAAElD,UAAU,CAAClB,CAAC,CAAC,qCAAqC,EAAE;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":[]}
|
package/lib/text-select.js
CHANGED
|
@@ -1,73 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
22
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
14
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
16
|
var _tokenSelect = _interopRequireDefault(require("./token-select"));
|
|
29
|
-
|
|
30
17
|
var _builder = require("./tokenizer/builder");
|
|
31
|
-
|
|
32
18
|
var _token = require("./token-select/token");
|
|
33
|
-
|
|
34
19
|
var _debug = _interopRequireDefault(require("debug"));
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
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); }; }
|
|
41
|
-
|
|
42
|
-
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; } }
|
|
43
|
-
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
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; })(); }
|
|
44
24
|
var log = (0, _debug["default"])('@pie-lib:text-select');
|
|
45
25
|
/**
|
|
46
26
|
* Built on TokenSelect uses build.normalize to build the token set.
|
|
47
27
|
*/
|
|
48
|
-
|
|
49
|
-
var TextSelect = /*#__PURE__*/function (_React$Component) {
|
|
50
|
-
(0, _inherits2["default"])(TextSelect, _React$Component);
|
|
51
|
-
|
|
52
|
-
var _super = _createSuper(TextSelect);
|
|
53
|
-
|
|
28
|
+
var TextSelect = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
54
29
|
function TextSelect() {
|
|
55
30
|
var _this;
|
|
56
|
-
|
|
57
31
|
(0, _classCallCheck2["default"])(this, TextSelect);
|
|
58
|
-
|
|
59
32
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
33
|
args[_key] = arguments[_key];
|
|
61
34
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "change", function (tokens) {
|
|
35
|
+
_this = _callSuper(this, TextSelect, [].concat(args));
|
|
36
|
+
(0, _defineProperty2["default"])(_this, "change", function (tokens) {
|
|
65
37
|
var onChange = _this.props.onChange;
|
|
66
|
-
|
|
67
38
|
if (!onChange) {
|
|
68
39
|
return;
|
|
69
40
|
}
|
|
70
|
-
|
|
71
41
|
var out = tokens.filter(function (t) {
|
|
72
42
|
return t.selected;
|
|
73
43
|
}).map(function (t) {
|
|
@@ -80,19 +50,19 @@ var TextSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
80
50
|
});
|
|
81
51
|
return _this;
|
|
82
52
|
}
|
|
83
|
-
|
|
84
|
-
(0, _createClass2["default"])(TextSelect, [{
|
|
53
|
+
(0, _inherits2["default"])(TextSelect, _React$Component);
|
|
54
|
+
return (0, _createClass2["default"])(TextSelect, [{
|
|
85
55
|
key: "render",
|
|
86
56
|
value: function render() {
|
|
87
57
|
var _this$props = this.props,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
58
|
+
text = _this$props.text,
|
|
59
|
+
disabled = _this$props.disabled,
|
|
60
|
+
tokens = _this$props.tokens,
|
|
61
|
+
selectedTokens = _this$props.selectedTokens,
|
|
62
|
+
className = _this$props.className,
|
|
63
|
+
highlightChoices = _this$props.highlightChoices,
|
|
64
|
+
maxNoOfSelections = _this$props.maxNoOfSelections,
|
|
65
|
+
animationsDisabled = _this$props.animationsDisabled;
|
|
96
66
|
var normalized = (0, _builder.normalize)(text, tokens);
|
|
97
67
|
log('normalized: ', normalized);
|
|
98
68
|
var prepped = normalized.map(function (t) {
|
|
@@ -120,10 +90,7 @@ var TextSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
120
90
|
});
|
|
121
91
|
}
|
|
122
92
|
}]);
|
|
123
|
-
return TextSelect;
|
|
124
93
|
}(_react["default"].Component);
|
|
125
|
-
|
|
126
|
-
exports["default"] = TextSelect;
|
|
127
94
|
(0, _defineProperty2["default"])(TextSelect, "propTypes", {
|
|
128
95
|
onChange: _propTypes["default"].func,
|
|
129
96
|
disabled: _propTypes["default"].bool,
|