@pie-lib/mask-markup 3.1.3 → 4.0.0-next.37

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.
Files changed (113) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +4 -0
  2. package/dist/choices/choice.d.ts +28 -0
  3. package/dist/choices/choice.js +92 -0
  4. package/dist/choices/index.d.ts +29 -0
  5. package/dist/choices/index.js +59 -0
  6. package/dist/componentize.d.ts +12 -0
  7. package/dist/componentize.js +4 -0
  8. package/dist/components/blank.d.ts +45 -0
  9. package/dist/components/blank.js +273 -0
  10. package/dist/components/correct-input.d.ts +11 -0
  11. package/dist/components/dropdown.d.ts +37 -0
  12. package/dist/components/dropdown.js +311 -0
  13. package/dist/components/input.d.ts +37 -0
  14. package/dist/constructed-response.d.ts +44 -0
  15. package/dist/constructed-response.js +56 -0
  16. package/dist/customizable.d.ts +43 -0
  17. package/dist/customizable.js +8 -0
  18. package/dist/drag-in-the-blank.d.ts +47 -0
  19. package/dist/drag-in-the-blank.js +220 -0
  20. package/dist/index.d.ts +15 -0
  21. package/dist/index.js +7 -0
  22. package/dist/inline-dropdown.d.ts +44 -0
  23. package/dist/inline-dropdown.js +24 -0
  24. package/dist/keyboard-coordinates.d.ts +25 -0
  25. package/dist/keyboard-coordinates.js +49 -0
  26. package/dist/mask.d.ts +30 -0
  27. package/dist/mask.js +95 -0
  28. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  29. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
  30. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
  31. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
  32. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
  33. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
  34. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
  35. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
  36. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
  37. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
  38. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
  39. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
  40. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
  41. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
  42. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
  43. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
  44. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
  45. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
  46. package/dist/serialization.d.ts +34 -0
  47. package/dist/serialization.js +132 -0
  48. package/dist/with-mask.d.ts +55 -0
  49. package/dist/with-mask.js +45 -0
  50. package/package.json +35 -19
  51. package/CHANGELOG.json +0 -17
  52. package/CHANGELOG.md +0 -1353
  53. package/LICENSE.md +0 -5
  54. package/lib/choices/choice.js +0 -138
  55. package/lib/choices/choice.js.map +0 -1
  56. package/lib/choices/index.js +0 -126
  57. package/lib/choices/index.js.map +0 -1
  58. package/lib/componentize.js +0 -21
  59. package/lib/componentize.js.map +0 -1
  60. package/lib/components/blank.js +0 -489
  61. package/lib/components/blank.js.map +0 -1
  62. package/lib/components/correct-input.js +0 -94
  63. package/lib/components/correct-input.js.map +0 -1
  64. package/lib/components/dropdown.js +0 -480
  65. package/lib/components/dropdown.js.map +0 -1
  66. package/lib/components/input.js +0 -50
  67. package/lib/components/input.js.map +0 -1
  68. package/lib/constructed-response.js +0 -101
  69. package/lib/constructed-response.js.map +0 -1
  70. package/lib/customizable.js +0 -42
  71. package/lib/customizable.js.map +0 -1
  72. package/lib/drag-in-the-blank.js +0 -363
  73. package/lib/drag-in-the-blank.js.map +0 -1
  74. package/lib/index.js +0 -55
  75. package/lib/index.js.map +0 -1
  76. package/lib/inline-dropdown.js +0 -40
  77. package/lib/inline-dropdown.js.map +0 -1
  78. package/lib/keyboard-coordinates.js +0 -156
  79. package/lib/keyboard-coordinates.js.map +0 -1
  80. package/lib/mask.js +0 -203
  81. package/lib/mask.js.map +0 -1
  82. package/lib/serialization.js +0 -261
  83. package/lib/serialization.js.map +0 -1
  84. package/lib/with-mask.js +0 -97
  85. package/lib/with-mask.js.map +0 -1
  86. package/src/__tests__/drag-in-the-blank.test.js +0 -256
  87. package/src/__tests__/index.test.js +0 -38
  88. package/src/__tests__/keyboard-coordinates.test.js +0 -202
  89. package/src/__tests__/mask.test.js +0 -479
  90. package/src/__tests__/serialization.test.js +0 -54
  91. package/src/__tests__/utils.js +0 -1
  92. package/src/__tests__/with-mask.test.js +0 -76
  93. package/src/choices/__tests__/index.test.js +0 -212
  94. package/src/choices/choice.jsx +0 -113
  95. package/src/choices/index.jsx +0 -88
  96. package/src/componentize.js +0 -13
  97. package/src/components/__tests__/blank.test.js +0 -413
  98. package/src/components/__tests__/correct-input.test.js +0 -90
  99. package/src/components/__tests__/dropdown.test.js +0 -129
  100. package/src/components/__tests__/input.test.js +0 -102
  101. package/src/components/blank.jsx +0 -504
  102. package/src/components/correct-input.jsx +0 -82
  103. package/src/components/dropdown.jsx +0 -421
  104. package/src/components/input.jsx +0 -48
  105. package/src/constructed-response.jsx +0 -87
  106. package/src/customizable.jsx +0 -34
  107. package/src/drag-in-the-blank.jsx +0 -351
  108. package/src/index.js +0 -16
  109. package/src/inline-dropdown.jsx +0 -29
  110. package/src/keyboard-coordinates.js +0 -147
  111. package/src/mask.jsx +0 -174
  112. package/src/serialization.js +0 -260
  113. package/src/with-mask.jsx +0 -75
@@ -1 +0,0 @@
1
- {"version":3,"file":"correct-input.js","names":["_react","_interopRequireDefault","require","_OutlinedInput","_classnames2","_styles","_renderUi","_excluded","StyledOutlinedInput","styled","OutlinedInput","padding","borderRadius","fontSize","display","verticalAlign","border","color","text","backgroundColor","background","borderWidth","borderStyle","opacity","cursor","borderColor","primary","primaryDark","concat","correct","incorrect","CorrectInput","props","charactersLimit","disabled","isBox","isConstructedResponse","width","spellCheck","rest","_objectWithoutProperties2","label","undefined","inputProps","maxLength","style","Math","round","createElement","_extends2","className","classnames","disabledInput","box","classes","input","_defineProperty2","_default","exports"],"sources":["../../src/components/correct-input.jsx"],"sourcesContent":["import React from 'react';\nimport OutlinedInput from '@mui/material/OutlinedInput';\nimport classnames from 'classnames';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst StyledOutlinedInput = styled(OutlinedInput)(() => ({\n padding: '2px',\n borderRadius: '4px',\n fontSize: 'inherit',\n display: 'inline-block',\n verticalAlign: 'middle',\n '& fieldset': {\n border: 0,\n },\n '& .MuiOutlinedInput-input': {\n color: color.text(),\n backgroundColor: color.background(),\n borderRadius: '4px !important',\n borderWidth: '1px',\n borderStyle: 'solid',\n padding: '10px 20px 10px 10px',\n '&:disabled': {\n opacity: 0.8,\n cursor: 'not-allowed !important',\n },\n '&:hover': {\n borderColor: color.primary(),\n '&:disabled': {\n borderColor: 'initial',\n },\n },\n '&.Mui-focused': {\n borderColor: color.primaryDark(),\n },\n '&.crInput': {\n padding: '8px !important',\n },\n '&.correct': {\n borderColor: `${color.correct()} !important`,\n },\n '&.incorrect': {\n borderColor: `${color.incorrect()} !important`,\n },\n },\n}));\n\nconst CorrectInput = (props) => {\n const { correct, charactersLimit, disabled, isBox, isConstructedResponse, width, spellCheck, ...rest } = props;\n\n const label = typeof correct === 'boolean' ? (correct ? 'correct' : 'incorrect') : undefined;\n const inputProps = charactersLimit\n ? { maxLength: charactersLimit, 'aria-label': 'Enter answer' }\n : { 'aria-label': 'Enter answer' };\n\n if (width) {\n inputProps.style = {\n width: `${width + Math.round(width / 10) + 1}ch`, // added some extra space for capital letters\n };\n }\n\n return (\n <StyledOutlinedInput\n className={classnames({\n disabledInput: disabled,\n box: isBox,\n })}\n classes={{\n input: classnames({\n [label]: label,\n crInput: isConstructedResponse,\n }),\n }}\n inputProps={inputProps}\n disabled={disabled}\n spellCheck={spellCheck}\n {...rest}\n />\n );\n};\n\nexport default CorrectInput;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAA2C,IAAAK,SAAA;AAE3C,IAAMC,mBAAmB,GAAG,IAAAC,cAAM,EAACC,yBAAa,CAAC,CAAC;EAAA,OAAO;IACvDC,OAAO,EAAE,KAAK;IACdC,YAAY,EAAE,KAAK;IACnBC,QAAQ,EAAE,SAAS;IACnBC,OAAO,EAAE,cAAc;IACvBC,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE;MACZC,MAAM,EAAE;IACV,CAAC;IACD,2BAA2B,EAAE;MAC3BC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;MACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC,CAAC;MACnCR,YAAY,EAAE,gBAAgB;MAC9BS,WAAW,EAAE,KAAK;MAClBC,WAAW,EAAE,OAAO;MACpBX,OAAO,EAAE,qBAAqB;MAC9B,YAAY,EAAE;QACZY,OAAO,EAAE,GAAG;QACZC,MAAM,EAAE;MACV,CAAC;MACD,SAAS,EAAE;QACTC,WAAW,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AG,CAAC,OAAI,CAAE;IACpD,CAAC;EACH;EAEA,oBACErC,MAAA,YAAAgD,aAAA,CAACxC,mBAAmB,MAAAyC,SAAA;IAClBC,SAAS,EAAE,IAAAC,uBAAU,EAAC;MACpBC,aAAa,EAAElB,QAAQ;MACvBmB,GAAG,EAAElB;IACP,CAAC,CAAE;IACHmB,OAAO,EAAE;MACPC,KAAK,EAAE,IAAAJ,uBAAU,MAAAK,gBAAA,iBAAAA,gBAAA,iBACdf,KAAK,EAAGA,KAAK,cACLL,qBAAqB,CAC/B;IACH,CAAE;IACFO,UAAU,EAAEA,UAAW;IACvBT,QAAQ,EAAEA,QAAS;IACnBI,UAAU,EAAEA;EAAW,GACnBC,IAAI,CACT,CAAC;AAEN,CAAC;AAAC,IAAAkB,QAAA,GAAAC,OAAA,cAEa3B,YAAY","ignoreList":[]}
@@ -1,480 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _propTypes = _interopRequireDefault(require("prop-types"));
16
- var _Button = _interopRequireDefault(require("@mui/material/Button"));
17
- var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
18
- var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
19
- var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
20
- var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
21
- var _ArrowDropUp = _interopRequireDefault(require("@mui/icons-material/ArrowDropUp"));
22
- var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
23
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
24
- var _styles = require("@mui/material/styles");
25
- var _renderUi = require("@pie-lib/render-ui");
26
- var _mathRendering = require("@pie-lib/math-rendering");
27
- 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; }
28
- 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; }
29
- 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)); }
30
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
31
- var pieVar = _renderUi.color.v('pie');
32
- var StyledButton = (0, _styles.styled)(_Button["default"])(function () {
33
- return {
34
- color: _renderUi.color.text(),
35
- border: "1px solid ".concat(_renderUi.color.borderGray()),
36
- borderRadius: '4px',
37
- justifyContent: 'space-between',
38
- backgroundColor: _renderUi.color.background(),
39
- position: 'relative',
40
- height: '45px',
41
- width: 'fit-content',
42
- margin: '2px',
43
- textTransform: 'none',
44
- '& span': {
45
- paddingRight: '24px'
46
- },
47
- '& svg': {
48
- position: 'absolute',
49
- right: '4px',
50
- top: 'calc(50% - 12px)',
51
- pointerEvents: 'none',
52
- color: _renderUi.color.text(),
53
- marginLeft: '5px'
54
- },
55
- '&.Mui-focused': {
56
- outline: "3px solid ".concat(_renderUi.color.tertiary()),
57
- outlineOffset: '2px',
58
- borderWidth: '3px'
59
- },
60
- '&.disabledCorrect': {
61
- borderWidth: '2px',
62
- borderColor: _renderUi.color.correct(),
63
- color: "".concat(_renderUi.color.text(), " !important")
64
- },
65
- '&.disabledIncorrect': {
66
- borderWidth: '2px',
67
- borderColor: _renderUi.color.incorrectWithIcon(),
68
- color: "".concat(_renderUi.color.text(), " !important")
69
- }
70
- };
71
- });
72
- var StyledMenu = (0, _styles.styled)(_Menu["default"])(function () {
73
- return {
74
- '& .MuiPaper-root': {
75
- // honour the host's --pie-background, but stay opaque when it is undefined:
76
- // color.background() falls back to rgba(255,255,255,0), which makes the open
77
- // menu transparent and unreadable over the item content (PIE-1008)
78
- backgroundColor: pieVar('background', _renderUi.color.defaults.WHITE)
79
- },
80
- // remove default padding on the inner list
81
- '& .MuiList-root': {
82
- padding: 0
83
- }
84
- };
85
- });
86
- var StyledMenuItem = (0, _styles.styled)(_MenuItem["default"])(function () {
87
- return {
88
- // base text/layout styles (from old JSS - before mui v5 migration)
89
- height: 24,
90
- overflow: 'hidden',
91
- fontSize: '1rem',
92
- fontWeight: 400,
93
- fontFamily: 'inherit',
94
- lineHeight: '1.5em',
95
- whiteSpace: 'nowrap',
96
- // custom styles
97
- color: _renderUi.color.text(),
98
- backgroundColor: _renderUi.color.background(),
99
- '&.Mui-focusVisible': {
100
- outline: "3px solid ".concat(_renderUi.color.tertiary()),
101
- outlineOffset: '-1px',
102
- // keeps it inside the item
103
- color: _renderUi.color.text(),
104
- backgroundColor: _renderUi.color.background()
105
- },
106
- '&:hover': {
107
- color: _renderUi.color.text(),
108
- backgroundColor: _renderUi.color.dropdownBackground()
109
- },
110
- boxSizing: 'border-box',
111
- padding: '16px 8px',
112
- borderRadius: '4px',
113
- '&.selected': {
114
- color: "".concat(_renderUi.color.text(), " !important"),
115
- backgroundColor: "".concat(_renderUi.color.background(), " !important"),
116
- '&:hover': {
117
- color: _renderUi.color.text(),
118
- backgroundColor: "".concat(_renderUi.color.dropdownBackground(), " !important")
119
- }
120
- }
121
- };
122
- });
123
- var StyledLabel = (0, _styles.styled)('span')(function () {
124
- return {
125
- fontSize: 'max(1rem, 14px)'
126
- };
127
- });
128
- var StyledSelectedIndicator = (0, _styles.styled)('span')(function () {
129
- return {
130
- fontSize: 'max(1rem, 14px)',
131
- flexShrink: 0,
132
- paddingLeft: '8px'
133
- };
134
- });
135
- var StyledInputLabel = (0, _styles.styled)(_InputLabel["default"])(function () {
136
- return {
137
- position: 'absolute',
138
- left: '-10000px',
139
- top: 'auto',
140
- width: '1px',
141
- height: '1px',
142
- overflow: 'hidden'
143
- };
144
- });
145
- var StyledCorrectnessIcon = (0, _styles.styled)(_Check["default"])(function () {
146
- return {
147
- color: "".concat(_renderUi.color.white(), " !important"),
148
- position: 'absolute',
149
- top: '-8px !important',
150
- left: '-8px',
151
- marginLeft: '0 !important',
152
- borderRadius: '50%',
153
- fontSize: '16px',
154
- padding: '2px',
155
- '&.correct': {
156
- backgroundColor: _renderUi.color.correct()
157
- },
158
- '&.incorrect': {
159
- backgroundColor: _renderUi.color.incorrectWithIcon()
160
- }
161
- };
162
- });
163
- var StyledIncorrectnessIcon = (0, _styles.styled)(_Close["default"])(function () {
164
- return {
165
- color: "".concat(_renderUi.color.white(), " !important"),
166
- position: 'absolute',
167
- top: '-8px !important',
168
- left: '-8px',
169
- marginLeft: '0 !important',
170
- borderRadius: '50%',
171
- fontSize: '16px',
172
- padding: '2px',
173
- '&.correct': {
174
- backgroundColor: _renderUi.color.correct()
175
- },
176
- '&.incorrect': {
177
- backgroundColor: _renderUi.color.incorrectWithIcon()
178
- }
179
- };
180
- });
181
- var Dropdown = /*#__PURE__*/function (_React$Component) {
182
- function Dropdown(props) {
183
- var _this;
184
- (0, _classCallCheck2["default"])(this, Dropdown);
185
- _this = _callSuper(this, Dropdown, [props]);
186
- (0, _defineProperty2["default"])(_this, "handleClick", function (event) {
187
- var _this$props = _this.props,
188
- id = _this$props.id,
189
- value = _this$props.value,
190
- choices = _this$props.choices;
191
- var highlightedOptionId = null;
192
- if (value) {
193
- var selectedIndex = (choices || []).findIndex(function (c) {
194
- return c.value === value;
195
- });
196
- if (selectedIndex >= 0) {
197
- highlightedOptionId = "dropdown-option-".concat(id, "-").concat(selectedIndex);
198
- }
199
- }
200
- _this.setState({
201
- anchorEl: event.currentTarget,
202
- highlightedOptionId: highlightedOptionId
203
- });
204
- });
205
- (0, _defineProperty2["default"])(_this, "handleClose", function () {
206
- var value = _this.props.value;
207
- _this.setState({
208
- anchorEl: null,
209
- previewValue: null,
210
- highlightedOptionId: null
211
- });
212
- // clear displayed preview if no selection
213
- if (!value && _this.previewRef.current) {
214
- _this.previewRef.current.innerHTML = '';
215
- }
216
- });
217
- (0, _defineProperty2["default"])(_this, "handleHighlight", function (index) {
218
- var highlightedOptionId = "dropdown-option-".concat(_this.props.id, "-").concat(index);
219
-
220
- // preview on hover if nothing selected
221
- var stateUpdate = {
222
- highlightedOptionId: highlightedOptionId
223
- };
224
- if (!_this.props.value) {
225
- stateUpdate.previewValue = _this.props.choices[index].value;
226
- }
227
- _this.setState(stateUpdate);
228
- });
229
- (0, _defineProperty2["default"])(_this, "handleSelect", function (value, index) {
230
- _this.props.onChange(_this.props.id, value);
231
- _this.handleHighlight(index);
232
- _this.handleClose();
233
- });
234
- (0, _defineProperty2["default"])(_this, "handleHover", function (index) {
235
- var selectedValue = _this.props.value;
236
- if (selectedValue) return;
237
- var highlightedOptionId = "dropdown-option-".concat(_this.props.id, "-").concat(index);
238
- var previewValue = _this.state.previewValue;
239
- _this.setState({
240
- highlightedOptionId: highlightedOptionId,
241
- previewValue: previewValue
242
- }, function () {
243
- // On hover, preview the math-rendered content inside the button if no value is selected.
244
- var ref = _this.elementRefs[index];
245
- var preview = _this.previewRef.current;
246
- if (ref && preview) {
247
- preview.innerHTML = ref.innerHTML;
248
- }
249
- });
250
- });
251
- _this.state = {
252
- anchorEl: null,
253
- highlightedOptionId: null,
254
- menuWidth: null,
255
- previewValue: null
256
- };
257
- _this.hiddenRef = /*#__PURE__*/_react["default"].createRef();
258
- _this.buttonRef = /*#__PURE__*/_react["default"].createRef();
259
- _this.previewRef = /*#__PURE__*/_react["default"].createRef();
260
- _this.elementRefs = [];
261
- return _this;
262
- }
263
- (0, _inherits2["default"])(Dropdown, _React$Component);
264
- return (0, _createClass2["default"])(Dropdown, [{
265
- key: "componentDidMount",
266
- value: function componentDidMount() {
267
- // measure hidden menu width once
268
- if (this.hiddenRef.current && this.state.menuWidth === null) {
269
- this.setState({
270
- menuWidth: this.hiddenRef.current.clientWidth
271
- });
272
- }
273
- }
274
- }, {
275
- key: "componentDidUpdate",
276
- value: function componentDidUpdate(prevProps, prevState) {
277
- var hiddenEl = this.hiddenRef.current;
278
- var dropdownJustOpened = !prevState.anchorEl && this.state.anchorEl;
279
- if (dropdownJustOpened) {
280
- this.elementRefs.forEach(function (ref) {
281
- if (!ref) return;
282
- var containsLatex = ref.querySelector('[data-latex], [data-raw]');
283
- var hasMathJax = ref.querySelector('mjx-container');
284
- var mathHandled = ref.querySelector('[data-math-handled="true"]');
285
- if (containsLatex && (!mathHandled || !hasMathJax)) {
286
- (0, _mathRendering.renderMath)(ref);
287
- }
288
- });
289
- }
290
- if (hiddenEl) {
291
- var newWidth = hiddenEl.clientWidth;
292
- if (newWidth !== this.state.menuWidth) {
293
- this.elementRefs.forEach(function (ref) {
294
- if (ref) (0, _mathRendering.renderMath)(ref);
295
- });
296
- (0, _mathRendering.renderMath)(hiddenEl);
297
- this.setState({
298
- menuWidth: newWidth
299
- });
300
- }
301
- }
302
- }
303
- }, {
304
- key: "getLabel",
305
- value: function getLabel(choices, value) {
306
- var found = (choices || []).find(function (choice) {
307
- return choice.value === value;
308
- });
309
- return found ? found.label.trim() : undefined;
310
- }
311
- }, {
312
- key: "render",
313
- value: function render() {
314
- var _this2 = this;
315
- var _this$props2 = this.props,
316
- id = _this$props2.id,
317
- correct = _this$props2.correct,
318
- disabled = _this$props2.disabled,
319
- value = _this$props2.value,
320
- choices = _this$props2.choices,
321
- showCorrectAnswer = _this$props2.showCorrectAnswer,
322
- singleQuery = _this$props2.singleQuery,
323
- correctValue = _this$props2.correctValue;
324
- var anchorEl = this.state.anchorEl;
325
- var open = Boolean(anchorEl);
326
- var buttonId = "dropdown-button-".concat(id);
327
- var menuId = "dropdown-menu-".concat(id);
328
- var valueDisplayId = "dropdown-value-".concat(id);
329
-
330
- // Determine the class for disabled state, view mode and evaluate mode
331
- var disabledClass;
332
- // Reset elementRefs before each render to avoid stale references
333
- this.elementRefs = [];
334
- if (disabled && correct !== undefined) {
335
- disabledClass = correct || showCorrectAnswer ? 'disabledCorrect' : 'disabledIncorrect';
336
- }
337
-
338
- // Create distinct, visually hidden labels for each dropdown
339
- var incrementedId = parseInt(id, 10) + 1;
340
- var labelId = singleQuery ? 'Query-label' : "Query-label-".concat(incrementedId);
341
- var labelText = singleQuery ? 'Query' : "Query ".concat(incrementedId);
342
-
343
- // Changed from Select to Button for dropdown to enhance accessibility. This modification offers explicit control over aria attributes and focuses management, ensuring the dropdown is compliant with accessibility standards. The use of Button and Menu components allows for better handling of keyboard interactions and provides accessible labels and menus, aligning with WCAG guidelines and improving usability for assistive technology users.
344
- var correctnessIcon = null;
345
- if (disabled && correct !== undefined) {
346
- correctnessIcon = correct || showCorrectAnswer ? /*#__PURE__*/_react["default"].createElement(StyledCorrectnessIcon, {
347
- className: "correct"
348
- }) : /*#__PURE__*/_react["default"].createElement(StyledIncorrectnessIcon, {
349
- className: "incorrect"
350
- });
351
- }
352
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
353
- ref: this.hiddenRef,
354
- style: {
355
- position: 'absolute',
356
- visibility: 'hidden',
357
- top: 0,
358
- left: 0
359
- },
360
- tabIndex: -1,
361
- "aria-hidden": "true"
362
- }, (choices || []).map(function (c, index) {
363
- return /*#__PURE__*/_react["default"].createElement(StyledMenuItem, {
364
- key: index,
365
- tabIndex: -1,
366
- "aria-hidden": "true"
367
- }, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
368
- dangerouslySetInnerHTML: {
369
- __html: c.label
370
- }
371
- }));
372
- })), /*#__PURE__*/_react["default"].createElement(StyledInputLabel, {
373
- id: labelId,
374
- tabIndex: -1,
375
- "aria-hidden": "true"
376
- }, labelText), /*#__PURE__*/_react["default"].createElement(StyledButton, {
377
- ref: this.buttonRef,
378
- style: _objectSpread(_objectSpread({}, this.state.menuWidth && {
379
- minWidth: "calc(".concat(this.state.menuWidth, "px + 8px)")
380
- }), {}, {
381
- borderWidth: open ? '2px' : '1px',
382
- transition: 'border-width 0.2s ease-in-out'
383
- }),
384
- "aria-controls": open ? menuId : undefined,
385
- "aria-haspopup": "listbox",
386
- "aria-expanded": open ? 'true' : undefined,
387
- "aria-activedescendant": this.state.highlightedOptionId,
388
- onClick: this.handleClick,
389
- className: disabledClass,
390
- disabled: disabled,
391
- id: buttonId,
392
- role: "combobox",
393
- "aria-label": "Select an option for ".concat(labelText),
394
- "aria-labelledby": valueDisplayId
395
- }, correctnessIcon, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
396
- id: valueDisplayId,
397
- ref: this.previewRef,
398
- dangerouslySetInnerHTML: {
399
- __html: correctValue ? correctValue : open && this.state.previewValue ? this.getLabel(choices, this.state.previewValue) : this.getLabel(choices, value) || ''
400
- }
401
- }), open ? /*#__PURE__*/_react["default"].createElement(_ArrowDropUp["default"], null) : /*#__PURE__*/_react["default"].createElement(_ArrowDropDown["default"], null)), /*#__PURE__*/_react["default"].createElement(StyledMenu, {
402
- id: menuId,
403
- anchorEl: anchorEl,
404
- keepMounted: true,
405
- open: open,
406
- onClose: this.handleClose,
407
- getContentAnchorEl: null,
408
- anchorOrigin: {
409
- vertical: 'bottom',
410
- horizontal: 'left'
411
- },
412
- transformOrigin: {
413
- vertical: 'top',
414
- horizontal: 'left'
415
- },
416
- transitionDuration: {
417
- enter: 225,
418
- exit: 195
419
- },
420
- slotProps: {
421
- paper: this.state.menuWidth ? {
422
- style: {
423
- minWidth: this.state.menuWidth,
424
- padding: '4px'
425
- }
426
- } : undefined,
427
- list: {
428
- 'aria-labelledby': buttonId,
429
- role: 'listbox',
430
- disablePadding: true
431
- }
432
- }
433
- }, (choices || []).map(function (c, index) {
434
- var optionId = "dropdown-option-".concat(id, "-").concat(index);
435
- return /*#__PURE__*/_react["default"].createElement(StyledMenuItem, {
436
- id: optionId,
437
- className: c.value === value ? 'selected' : '',
438
- selected: c.value === value,
439
- key: "".concat(c.label, "-").concat(index),
440
- value: c.value,
441
- onClick: function onClick() {
442
- return _this2.handleSelect(c.value, index);
443
- },
444
- role: "option",
445
- "aria-selected": _this2.state.highlightedOptionId === optionId ? 'true' : undefined,
446
- onMouseOver: function onMouseOver() {
447
- return _this2.handleHover(index);
448
- }
449
- }, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
450
- ref: function ref(_ref) {
451
- return _this2.elementRefs[index] = _ref;
452
- },
453
- dangerouslySetInnerHTML: {
454
- __html: c.label
455
- }
456
- }), /*#__PURE__*/_react["default"].createElement(StyledSelectedIndicator, {
457
- dangerouslySetInnerHTML: {
458
- __html: c.value === value ? ' &check;' : ''
459
- }
460
- }));
461
- })));
462
- }
463
- }]);
464
- }(_react["default"].Component);
465
- (0, _defineProperty2["default"])(Dropdown, "propTypes", {
466
- id: _propTypes["default"].string,
467
- value: _propTypes["default"].string,
468
- disabled: _propTypes["default"].bool,
469
- onChange: _propTypes["default"].func,
470
- correct: _propTypes["default"].bool,
471
- choices: _propTypes["default"].arrayOf(_propTypes["default"].shape({
472
- value: _propTypes["default"].string,
473
- label: _propTypes["default"].string
474
- })),
475
- showCorrectAnswer: _propTypes["default"].bool,
476
- singleQuery: _propTypes["default"].bool,
477
- correctValue: _propTypes["default"].string
478
- });
479
- var _default = exports["default"] = Dropdown;
480
- //# sourceMappingURL=dropdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdown.js","names":["_react","_interopRequireDefault","require","_propTypes","_Button","_InputLabel","_Menu","_MenuItem","_ArrowDropDown","_ArrowDropUp","_Close","_Check","_styles","_renderUi","_mathRendering","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","pieVar","color","v","StyledButton","styled","Button","text","border","concat","borderGray","borderRadius","justifyContent","backgroundColor","background","position","height","width","margin","textTransform","paddingRight","right","top","pointerEvents","marginLeft","outline","tertiary","outlineOffset","borderWidth","borderColor","correct","incorrectWithIcon","StyledMenu","Menu","defaults","WHITE","padding","StyledMenuItem","MenuItem","overflow","fontSize","fontWeight","fontFamily","lineHeight","whiteSpace","dropdownBackground","boxSizing","StyledLabel","StyledSelectedIndicator","flexShrink","paddingLeft","StyledInputLabel","InputLabel","left","StyledCorrectnessIcon","Check","white","StyledIncorrectnessIcon","Close","Dropdown","_React$Component","props","_this","_classCallCheck2","event","_this$props","id","value","choices","highlightedOptionId","selectedIndex","findIndex","c","setState","anchorEl","currentTarget","previewValue","previewRef","current","innerHTML","index","stateUpdate","onChange","handleHighlight","handleClose","selectedValue","state","ref","elementRefs","preview","menuWidth","hiddenRef","React","createRef","buttonRef","_inherits2","_createClass2","key","componentDidMount","clientWidth","componentDidUpdate","prevProps","prevState","hiddenEl","dropdownJustOpened","containsLatex","querySelector","hasMathJax","mathHandled","renderMath","newWidth","getLabel","found","find","choice","label","trim","undefined","render","_this2","_this$props2","disabled","showCorrectAnswer","singleQuery","correctValue","open","buttonId","menuId","valueDisplayId","disabledClass","incrementedId","parseInt","labelId","labelText","correctnessIcon","createElement","className","Fragment","style","visibility","tabIndex","map","dangerouslySetInnerHTML","__html","minWidth","transition","onClick","handleClick","role","keepMounted","onClose","getContentAnchorEl","anchorOrigin","vertical","horizontal","transformOrigin","transitionDuration","enter","exit","slotProps","paper","list","disablePadding","optionId","selected","handleSelect","onMouseOver","handleHover","Component","PropTypes","string","bool","func","arrayOf","shape","_default","exports"],"sources":["../../src/components/dropdown.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@mui/material/Button';\nimport InputLabel from '@mui/material/InputLabel';\nimport Menu from '@mui/material/Menu';\nimport MenuItem from '@mui/material/MenuItem';\nimport ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';\nimport ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp';\nimport Close from '@mui/icons-material/Close';\nimport Check from '@mui/icons-material/Check';\nimport { styled } from '@mui/material/styles';\n\nimport { color } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst pieVar = color.v('pie');\n\nconst StyledButton = styled(Button)(() => ({\n color: color.text(),\n border: `1px solid ${color.borderGray()}`,\n borderRadius: '4px',\n justifyContent: 'space-between',\n backgroundColor: color.background(),\n position: 'relative',\n height: '45px',\n width: 'fit-content',\n margin: '2px',\n textTransform: 'none',\n '& span': {\n paddingRight: '24px',\n },\n '& svg': {\n position: 'absolute',\n right: '4px',\n top: 'calc(50% - 12px)',\n pointerEvents: 'none',\n color: color.text(),\n marginLeft: '5px',\n },\n '&.Mui-focused': {\n outline: `3px solid ${color.tertiary()}`,\n outlineOffset: '2px',\n borderWidth: '3px',\n },\n '&.disabledCorrect': {\n borderWidth: '2px',\n borderColor: color.correct(),\n color: `${color.text()} !important`,\n },\n '&.disabledIncorrect': {\n borderWidth: '2px',\n borderColor: color.incorrectWithIcon(),\n color: `${color.text()} !important`,\n },\n}));\n\nconst StyledMenu = styled(Menu)(() => ({\n '& .MuiPaper-root': {\n // honour the host's --pie-background, but stay opaque when it is undefined:\n // color.background() falls back to rgba(255,255,255,0), which makes the open\n // menu transparent and unreadable over the item content (PIE-1008)\n backgroundColor: pieVar('background', color.defaults.WHITE),\n },\n // remove default padding on the inner list\n '& .MuiList-root': {\n padding: 0,\n },\n}));\n\nconst StyledMenuItem = styled(MenuItem)(() => ({\n // base text/layout styles (from old JSS - before mui v5 migration)\n height: 24,\n overflow: 'hidden',\n fontSize: '1rem',\n fontWeight: 400,\n fontFamily: 'inherit',\n lineHeight: '1.5em',\n whiteSpace: 'nowrap',\n\n // custom styles\n color: color.text(),\n backgroundColor: color.background(),\n '&.Mui-focusVisible': {\n outline: `3px solid ${color.tertiary()}`,\n outlineOffset: '-1px', // keeps it inside the item\n color: color.text(),\n backgroundColor: color.background(),\n },\n '&:hover': {\n color: color.text(),\n backgroundColor: color.dropdownBackground(),\n },\n boxSizing: 'border-box',\n padding: '16px 8px',\n borderRadius: '4px',\n '&.selected': {\n color: `${color.text()} !important`,\n backgroundColor: `${color.background()} !important`,\n '&:hover': {\n color: color.text(),\n backgroundColor: `${color.dropdownBackground()} !important`,\n },\n },\n}));\n\nconst StyledLabel = styled('span')(() => ({\n fontSize: 'max(1rem, 14px)',\n}));\n\nconst StyledSelectedIndicator = styled('span')(() => ({\n fontSize: 'max(1rem, 14px)',\n flexShrink: 0,\n paddingLeft: '8px',\n}));\n\nconst StyledInputLabel = styled(InputLabel)(() => ({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n}));\n\nconst StyledCorrectnessIcon = styled(Check)(() => ({\n color: `${color.white()} !important`,\n position: 'absolute',\n top: '-8px !important',\n left: '-8px',\n marginLeft: '0 !important',\n borderRadius: '50%',\n fontSize: '16px',\n padding: '2px',\n '&.correct': {\n backgroundColor: color.correct(),\n },\n '&.incorrect': {\n backgroundColor: color.incorrectWithIcon(),\n },\n}));\n\nconst StyledIncorrectnessIcon = styled(Close)(() => ({\n color: `${color.white()} !important`,\n position: 'absolute',\n top: '-8px !important',\n left: '-8px',\n marginLeft: '0 !important',\n borderRadius: '50%',\n fontSize: '16px',\n padding: '2px',\n '&.correct': {\n backgroundColor: color.correct(),\n },\n '&.incorrect': {\n backgroundColor: color.incorrectWithIcon(),\n },\n}));\n\nclass Dropdown extends React.Component {\n static propTypes = {\n id: PropTypes.string,\n value: PropTypes.string,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n correct: PropTypes.bool,\n choices: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })),\n showCorrectAnswer: PropTypes.bool,\n singleQuery: PropTypes.bool,\n correctValue: PropTypes.string,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n anchorEl: null,\n highlightedOptionId: null,\n menuWidth: null,\n previewValue: null,\n };\n this.hiddenRef = React.createRef();\n this.buttonRef = React.createRef();\n this.previewRef = React.createRef();\n this.elementRefs = [];\n }\n\n componentDidMount() {\n // measure hidden menu width once\n if (this.hiddenRef.current && this.state.menuWidth === null) {\n this.setState({ menuWidth: this.hiddenRef.current.clientWidth });\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n const hiddenEl = this.hiddenRef.current;\n\n const dropdownJustOpened = !prevState.anchorEl && this.state.anchorEl;\n if (dropdownJustOpened) {\n this.elementRefs.forEach((ref) => {\n if (!ref) return;\n\n const containsLatex = ref.querySelector('[data-latex], [data-raw]');\n const hasMathJax = ref.querySelector('mjx-container');\n const mathHandled = ref.querySelector('[data-math-handled=\"true\"]');\n\n if (containsLatex && (!mathHandled || !hasMathJax)) {\n renderMath(ref);\n }\n });\n }\n\n if (hiddenEl) {\n const newWidth = hiddenEl.clientWidth;\n if (newWidth !== this.state.menuWidth) {\n this.elementRefs.forEach((ref) => {\n if (ref) renderMath(ref);\n });\n\n renderMath(hiddenEl);\n this.setState({ menuWidth: newWidth });\n }\n }\n }\n\n handleClick = (event) => {\n const { id, value, choices } = this.props;\n let highlightedOptionId = null;\n\n if (value) {\n const selectedIndex = (choices || []).findIndex((c) => c.value === value);\n if (selectedIndex >= 0) {\n highlightedOptionId = `dropdown-option-${id}-${selectedIndex}`;\n }\n }\n\n this.setState({ anchorEl: event.currentTarget, highlightedOptionId });\n };\n\n handleClose = () => {\n const { value } = this.props;\n this.setState({ anchorEl: null, previewValue: null, highlightedOptionId: null });\n // clear displayed preview if no selection\n if (!value && this.previewRef.current) {\n this.previewRef.current.innerHTML = '';\n }\n };\n\n handleHighlight = (index) => {\n const highlightedOptionId = `dropdown-option-${this.props.id}-${index}`;\n\n // preview on hover if nothing selected\n const stateUpdate = { highlightedOptionId };\n if (!this.props.value) {\n stateUpdate.previewValue = this.props.choices[index].value;\n }\n this.setState(stateUpdate);\n };\n\n handleSelect = (value, index) => {\n this.props.onChange(this.props.id, value);\n this.handleHighlight(index);\n this.handleClose();\n };\n\n handleHover = (index) => {\n const selectedValue = this.props.value;\n\n if (selectedValue) return;\n\n const highlightedOptionId = `dropdown-option-${this.props.id}-${index}`;\n const previewValue = this.state.previewValue;\n\n this.setState({ highlightedOptionId, previewValue }, () => {\n // On hover, preview the math-rendered content inside the button if no value is selected.\n const ref = this.elementRefs[index];\n const preview = this.previewRef.current;\n\n if (ref && preview) {\n preview.innerHTML = ref.innerHTML;\n }\n });\n };\n\n getLabel(choices, value) {\n const found = (choices || []).find((choice) => choice.value === value);\n\n return found ? found.label.trim() : undefined;\n }\n\n render() {\n const { id, correct, disabled, value, choices, showCorrectAnswer, singleQuery, correctValue } = this.props;\n const { anchorEl } = this.state;\n const open = Boolean(anchorEl);\n const buttonId = `dropdown-button-${id}`;\n const menuId = `dropdown-menu-${id}`;\n const valueDisplayId = `dropdown-value-${id}`;\n\n // Determine the class for disabled state, view mode and evaluate mode\n let disabledClass;\n // Reset elementRefs before each render to avoid stale references\n this.elementRefs = [];\n\n if (disabled && correct !== undefined) {\n disabledClass = correct || showCorrectAnswer ? 'disabledCorrect' : 'disabledIncorrect';\n }\n\n // Create distinct, visually hidden labels for each dropdown\n const incrementedId = parseInt(id, 10) + 1;\n const labelId = singleQuery ? 'Query-label' : `Query-label-${incrementedId}`;\n const labelText = singleQuery ? 'Query' : `Query ${incrementedId}`;\n\n // Changed from Select to Button for dropdown to enhance accessibility. This modification offers explicit control over aria attributes and focuses management, ensuring the dropdown is compliant with accessibility standards. The use of Button and Menu components allows for better handling of keyboard interactions and provides accessible labels and menus, aligning with WCAG guidelines and improving usability for assistive technology users.\n let correctnessIcon = null;\n if (disabled && correct !== undefined) {\n correctnessIcon =\n correct || showCorrectAnswer ? (\n <StyledCorrectnessIcon className=\"correct\" />\n ) : (\n <StyledIncorrectnessIcon className=\"incorrect\" />\n );\n }\n\n return (\n <>\n <div\n ref={this.hiddenRef}\n style={{ position: 'absolute', visibility: 'hidden', top: 0, left: 0 }}\n tabIndex={-1}\n aria-hidden=\"true\"\n >\n {(choices || []).map((c, index) => (\n <StyledMenuItem key={index} tabIndex={-1} aria-hidden=\"true\">\n <StyledLabel dangerouslySetInnerHTML={{ __html: c.label }} />\n </StyledMenuItem>\n ))}\n </div>\n <StyledInputLabel id={labelId} tabIndex={-1} aria-hidden=\"true\">\n {labelText}\n </StyledInputLabel>\n <StyledButton\n ref={this.buttonRef}\n style={{\n ...(this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` }),\n borderWidth: open ? '2px' : '1px',\n transition: 'border-width 0.2s ease-in-out',\n }}\n aria-controls={open ? menuId : undefined}\n aria-haspopup=\"listbox\"\n aria-expanded={open ? 'true' : undefined}\n aria-activedescendant={this.state.highlightedOptionId}\n onClick={this.handleClick}\n className={disabledClass}\n disabled={disabled}\n id={buttonId}\n role=\"combobox\"\n aria-label={`Select an option for ${labelText}`}\n aria-labelledby={valueDisplayId}\n >\n {correctnessIcon}\n <StyledLabel\n id={valueDisplayId}\n ref={this.previewRef}\n dangerouslySetInnerHTML={{\n __html: correctValue\n ? correctValue\n : open && this.state.previewValue\n ? this.getLabel(choices, this.state.previewValue)\n : this.getLabel(choices, value) || '',\n }}\n />\n {open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}\n </StyledButton>\n <StyledMenu\n id={menuId}\n anchorEl={anchorEl}\n keepMounted\n open={open}\n onClose={this.handleClose}\n getContentAnchorEl={null}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n transformOrigin={{ vertical: 'top', horizontal: 'left' }}\n transitionDuration={{ enter: 225, exit: 195 }}\n slotProps={{\n paper: this.state.menuWidth ? { style: { minWidth: this.state.menuWidth, padding: '4px' } } : undefined,\n list: {\n 'aria-labelledby': buttonId,\n role: 'listbox',\n disablePadding: true,\n },\n }}\n >\n {(choices || []).map((c, index) => {\n const optionId = `dropdown-option-${id}-${index}`;\n\n return (\n <StyledMenuItem\n id={optionId}\n className={c.value === value ? 'selected' : ''}\n selected={c.value === value}\n key={`${c.label}-${index}`}\n value={c.value}\n onClick={() => this.handleSelect(c.value, index)}\n role=\"option\"\n aria-selected={this.state.highlightedOptionId === optionId ? 'true' : undefined}\n onMouseOver={() => this.handleHover(index)}\n >\n <StyledLabel\n ref={(ref) => (this.elementRefs[index] = ref)}\n dangerouslySetInnerHTML={{ __html: c.label }}\n />\n <StyledSelectedIndicator dangerouslySetInnerHTML={{ __html: c.value === value ? ' &check;' : '' }} />\n </StyledMenuItem>\n );\n })}\n </StyledMenu>\n </>\n );\n }\n}\n\nexport default Dropdown;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,I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B/C,YAAY,EAAE6C,qBAAS,CAACC;AAC1B,CAAC;AAAA,IAAAK,QAAA,GAAAC,OAAA,cA2PYrH,QAAQ","ignoreList":[]}
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _correctInput = _interopRequireDefault(require("./correct-input"));
11
- var Input = function Input(_ref) {
12
- var disabled = _ref.disabled,
13
- correct = _ref.correct,
14
- charactersLimit = _ref.charactersLimit,
15
- id = _ref.id,
16
- isConstructedResponse = _ref.isConstructedResponse,
17
- value = _ref.value,
18
- _onChange = _ref.onChange,
19
- showCorrectAnswer = _ref.showCorrectAnswer,
20
- spellCheck = _ref.spellCheck,
21
- width = _ref.width;
22
- return /*#__PURE__*/_react["default"].createElement(_correctInput["default"], {
23
- disabled: disabled,
24
- correct: showCorrectAnswer || correct,
25
- charactersLimit: charactersLimit,
26
- variant: "outlined",
27
- value: value,
28
- isConstructedResponse: isConstructedResponse,
29
- spellCheck: spellCheck,
30
- isBox: true,
31
- width: width,
32
- onChange: function onChange(e) {
33
- _onChange(id, e.target.value);
34
- }
35
- });
36
- };
37
- Input.propTypes = {
38
- id: _propTypes["default"].string,
39
- value: _propTypes["default"].string,
40
- onChange: _propTypes["default"].func,
41
- disabled: _propTypes["default"].bool,
42
- spellCheck: _propTypes["default"].bool,
43
- correct: _propTypes["default"].bool,
44
- showCorrectAnswer: _propTypes["default"].bool,
45
- charactersLimit: _propTypes["default"].number,
46
- width: _propTypes["default"].number,
47
- isConstructedResponse: _propTypes["default"].bool
48
- };
49
- var _default = exports["default"] = Input;
50
- //# sourceMappingURL=input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","names":["_react","_interopRequireDefault","require","_propTypes","_correctInput","Input","_ref","disabled","correct","charactersLimit","id","isConstructedResponse","value","onChange","showCorrectAnswer","spellCheck","width","createElement","variant","isBox","e","target","propTypes","PropTypes","string","func","bool","number","_default","exports"],"sources":["../../src/components/input.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CorrectInput from './correct-input';\n\nconst Input = ({\n disabled,\n correct,\n charactersLimit,\n id,\n isConstructedResponse,\n value,\n onChange,\n showCorrectAnswer,\n spellCheck,\n width,\n}) => {\n return (\n <CorrectInput\n disabled={disabled}\n correct={showCorrectAnswer || correct}\n charactersLimit={charactersLimit}\n variant=\"outlined\"\n value={value}\n isConstructedResponse={isConstructedResponse}\n spellCheck={spellCheck}\n isBox={true}\n width={width}\n onChange={(e) => {\n onChange(id, e.target.value);\n }}\n />\n );\n};\n\nInput.propTypes = {\n id: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n spellCheck: PropTypes.bool,\n correct: PropTypes.bool,\n showCorrectAnswer: PropTypes.bool,\n charactersLimit: PropTypes.number,\n width: PropTypes.number,\n isConstructedResponse: PropTypes.bool,\n};\n\nexport default Input;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAMG,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAWL;EAAA,IAVJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IACPC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,qBAAqB,GAAAL,IAAA,CAArBK,qBAAqB;IACrBC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,SAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,iBAAiB,GAAAR,IAAA,CA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