@pie-lib/math-toolbar 3.1.0-beta.7 → 4.0.0-next.41

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 (40) hide show
  1. package/dist/done-button.d.ts +30 -0
  2. package/dist/done-button.js +35 -0
  3. package/dist/editor-and-pad.d.ts +47 -0
  4. package/dist/editor-and-pad.js +352 -0
  5. package/dist/index.d.ts +90 -0
  6. package/dist/index.js +158 -0
  7. package/dist/math-preview.d.ts +22 -0
  8. package/dist/math-preview.js +125 -0
  9. package/dist/utils.d.ts +9 -0
  10. package/dist/utils.js +9 -0
  11. package/package.json +30 -26
  12. package/CHANGELOG.json +0 -17
  13. package/CHANGELOG.md +0 -1049
  14. package/lib/__tests__/editor-and-pad-mathlive.test.js +0 -272
  15. package/lib/__tests__/editor-and-pad-mathlive.test.js.map +0 -1
  16. package/lib/__tests__/editor-and-pad.test.js +0 -78
  17. package/lib/__tests__/editor-and-pad.test.js.map +0 -1
  18. package/lib/__tests__/index.test.js +0 -27
  19. package/lib/__tests__/index.test.js.map +0 -1
  20. package/lib/__tests__/math-preview.test.js +0 -91
  21. package/lib/__tests__/math-preview.test.js.map +0 -1
  22. package/lib/done-button.js +0 -51
  23. package/lib/done-button.js.map +0 -1
  24. package/lib/editor-and-pad.js +0 -536
  25. package/lib/editor-and-pad.js.map +0 -1
  26. package/lib/index.js +0 -241
  27. package/lib/index.js.map +0 -1
  28. package/lib/math-preview.js +0 -206
  29. package/lib/math-preview.js.map +0 -1
  30. package/lib/utils.js +0 -17
  31. package/lib/utils.js.map +0 -1
  32. package/src/__tests__/editor-and-pad-mathlive.test.js +0 -178
  33. package/src/__tests__/editor-and-pad.test.js +0 -74
  34. package/src/__tests__/index.test.js +0 -21
  35. package/src/__tests__/math-preview.test.js +0 -83
  36. package/src/done-button.jsx +0 -36
  37. package/src/editor-and-pad.jsx +0 -505
  38. package/src/index.jsx +0 -220
  39. package/src/math-preview.jsx +0 -174
  40. package/src/utils.js +0 -11
@@ -1,272 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
5
- var _editorAndPad = require("../editor-and-pad");
6
- 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; }
7
- 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; }
8
- /**
9
- * Covers the call sites that changed when this package moved from
10
- * @pie-lib/math-input (MathQuill) to @pie-lib/math-input-mathlive.
11
- *
12
- * All three were MathQuill-shaped and silently changed meaning:
13
- * - shouldComponentUpdate read `this.input.mathField.latex()`, which throws now
14
- * (and the field loads asynchronously, so `this.input` can be null)
15
- * - the mixed-number workaround poked `__controller.cursor`, a MathQuill
16
- * internal with no MathLive equivalent
17
- * - onClick routes keypad presses through the imperative field API
18
- */
19
- describe('EditorAndPad after the MathLive migration', function () {
20
- var props = function props() {
21
- var over = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
- return _objectSpread({
23
- classes: {},
24
- classNames: {},
25
- onChange: jest.fn()
26
- }, over);
27
- };
28
- describe('shouldComponentUpdate', function () {
29
- it('treats a missing input ref as different, so the first render is not skipped', function () {
30
- var c = new _editorAndPad.EditorAndPad(props({
31
- latex: 'x'
32
- }));
33
- c.input = null;
34
- expect(c.shouldComponentUpdate({
35
- latex: 'x'
36
- }, {})).toBe(true);
37
- });
38
- it('does not throw when the math engine has not loaded yet', function () {
39
- var c = new _editorAndPad.EditorAndPad(props({
40
- latex: 'x'
41
- }));
42
-
43
- // latex() returns '' until MathLive is ready
44
- c.input = {
45
- latex: function latex() {
46
- return '';
47
- }
48
- };
49
- expect(function () {
50
- return c.shouldComponentUpdate({
51
- latex: 'x'
52
- }, {});
53
- }).not.toThrow();
54
- expect(c.shouldComponentUpdate({
55
- latex: 'x'
56
- }, {})).toBe(true);
57
- });
58
- it('skips the update when the field already holds the incoming latex', function () {
59
- var c = new _editorAndPad.EditorAndPad(props({
60
- latex: 'x',
61
- keypadMode: 'a',
62
- noDecimal: false
63
- }));
64
- c.input = {
65
- latex: function latex() {
66
- return 'x';
67
- }
68
- };
69
- c.state = {
70
- equationEditor: 'geometry'
71
- };
72
- expect(c.shouldComponentUpdate({
73
- latex: 'x',
74
- keypadMode: 'a',
75
- noDecimal: false
76
- }, c.state)).toBe(false);
77
- });
78
- it('re-renders when the field differs from the incoming latex', function () {
79
- var c = new _editorAndPad.EditorAndPad(props({
80
- latex: 'y'
81
- }));
82
- c.input = {
83
- latex: function latex() {
84
- return 'x';
85
- }
86
- };
87
- expect(c.shouldComponentUpdate({
88
- latex: 'y'
89
- }, {})).toBe(true);
90
- });
91
- it('uses input.latex(), never input.mathField.latex()', function () {
92
- var c = new _editorAndPad.EditorAndPad(props({
93
- latex: 'x'
94
- }));
95
- var latex = jest.fn(function () {
96
- return 'x';
97
- });
98
-
99
- // deliberately no `mathField` - the old code would have thrown here
100
- c.input = {
101
- latex: latex
102
- };
103
- c.state = {
104
- equationEditor: 'geometry'
105
- };
106
- c.shouldComponentUpdate({
107
- latex: 'x'
108
- }, c.state);
109
- expect(latex).toHaveBeenCalled();
110
- });
111
- });
112
- describe('onClick key routing', function () {
113
- var withInput = function withInput() {
114
- var over = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
115
- var c = new _editorAndPad.EditorAndPad(props(over));
116
- var calls = {
117
- write: [],
118
- command: [],
119
- keystroke: [],
120
- clear: 0
121
- };
122
- c.input = {
123
- write: function write(v) {
124
- return calls.write.push(v);
125
- },
126
- command: function command(v) {
127
- return calls.command.push(v);
128
- },
129
- keystroke: function keystroke(v) {
130
- return calls.keystroke.push(v);
131
- },
132
- clear: function clear() {
133
- return calls.clear++;
134
- }
135
- };
136
- c.updateDisable = function () {};
137
- return {
138
- c: c,
139
- calls: calls
140
- };
141
- };
142
-
143
- // toNodeData keys this off `value === 'clear'`, not `type`
144
- it('clear', function () {
145
- var _withInput = withInput(),
146
- c = _withInput.c,
147
- calls = _withInput.calls;
148
- c.onClick({
149
- value: 'clear'
150
- });
151
- expect(calls.clear).toBe(1);
152
- });
153
- it('command', function () {
154
- var _withInput2 = withInput(),
155
- c = _withInput2.c,
156
- calls = _withInput2.calls;
157
- c.onClick({
158
- type: 'command',
159
- value: '\\frac'
160
- });
161
- expect(calls.command).toEqual(['\\frac']);
162
- });
163
- it('cursor keystroke', function () {
164
- var _withInput3 = withInput(),
165
- c = _withInput3.c,
166
- calls = _withInput3.calls;
167
- c.onClick({
168
- type: 'cursor',
169
- value: 'Left'
170
- });
171
- expect(calls.keystroke).toEqual(['Left']);
172
- });
173
- it('answer block writes the response token', function () {
174
- var _withInput4 = withInput(),
175
- c = _withInput4.c,
176
- calls = _withInput4.calls;
177
- c.onClick({
178
- type: 'answer'
179
- });
180
- expect(calls.write).toEqual(['%response%']);
181
- });
182
- it('plain value', function () {
183
- var _withInput5 = withInput(),
184
- c = _withInput5.c,
185
- calls = _withInput5.calls;
186
- c.onClick({
187
- value: 'x'
188
- });
189
- expect(calls.write).toEqual(['x']);
190
- });
191
- it('ignores a nullish key', function () {
192
- var _withInput6 = withInput(),
193
- c = _withInput6.c,
194
- calls = _withInput6.calls;
195
- expect(function () {
196
- return c.onClick(null);
197
- }).not.toThrow();
198
- expect(calls.write).toEqual([]);
199
- });
200
- });
201
- describe('onEditorChange', function () {
202
- var withInput = function withInput() {
203
- var over = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
204
- var onChange = jest.fn();
205
- var c = new _editorAndPad.EditorAndPad(props(_objectSpread({
206
- onChange: onChange
207
- }, over)));
208
- var calls = {
209
- keystroke: [],
210
- clear: 0,
211
- write: []
212
- };
213
- c.input = {
214
- keystroke: function keystroke(v) {
215
- return calls.keystroke.push(v);
216
- },
217
- clear: function clear() {
218
- return calls.clear++;
219
- },
220
- write: function write(v) {
221
- return calls.write.push(v);
222
- }
223
- };
224
- c.updateDisable = function () {};
225
- return {
226
- c: c,
227
- onChange: onChange,
228
- calls: calls
229
- };
230
- };
231
- it('propagates ordinary latex to onChange', function () {
232
- var _withInput7 = withInput(),
233
- c = _withInput7.c,
234
- onChange = _withInput7.onChange;
235
- c.onEditorChange('\\frac{1}{2}');
236
- expect(onChange).toHaveBeenCalledWith('\\frac{1}{2}');
237
- });
238
- it('strips decimals when noDecimal is set', function () {
239
- var _withInput8 = withInput({
240
- noDecimal: true
241
- }),
242
- c = _withInput8.c,
243
- onChange = _withInput8.onChange,
244
- calls = _withInput8.calls;
245
- c.onEditorChange('1.5');
246
- expect(calls.clear).toBe(1);
247
- expect(calls.write).toEqual(['15']);
248
- expect(onChange).not.toHaveBeenCalled();
249
- });
250
- it('undoes the empty fraction after a digit with a public delete, not MathQuill internals', function () {
251
- var _withInput9 = withInput(),
252
- c = _withInput9.c,
253
- onChange = _withInput9.onChange,
254
- calls = _withInput9.calls;
255
-
256
- // the shape the old __controller hack targeted
257
- c.onEditorChange('2\\ \\frac{1}{ }');
258
- expect(calls.keystroke).toEqual(['Backspace']);
259
- expect(onChange).not.toHaveBeenCalled();
260
- });
261
- it('does not treat normal fractions as the mixed-number case', function () {
262
- var _withInput0 = withInput(),
263
- c = _withInput0.c,
264
- onChange = _withInput0.onChange,
265
- calls = _withInput0.calls;
266
- c.onEditorChange('\\frac{1}{2}');
267
- expect(calls.keystroke).toEqual([]);
268
- expect(onChange).toHaveBeenCalled();
269
- });
270
- });
271
- });
272
- //# sourceMappingURL=editor-and-pad-mathlive.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-and-pad-mathlive.test.js","names":["_editorAndPad","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","describe","props","over","undefined","classes","classNames","onChange","jest","fn","it","c","EditorAndPad","latex","input","expect","shouldComponentUpdate","toBe","not","toThrow","keypadMode","noDecimal","state","equationEditor","toHaveBeenCalled","withInput","calls","write","command","keystroke","clear","v","updateDisable","_withInput","onClick","value","_withInput2","type","toEqual","_withInput3","_withInput4","_withInput5","_withInput6","_withInput7","onEditorChange","toHaveBeenCalledWith","_withInput8","_withInput9","_withInput0"],"sources":["../../src/__tests__/editor-and-pad-mathlive.test.js"],"sourcesContent":["import { EditorAndPad } from '../editor-and-pad';\n\n/**\n * Covers the call sites that changed when this package moved from\n * @pie-lib/math-input (MathQuill) to @pie-lib/math-input-mathlive.\n *\n * All three were MathQuill-shaped and silently changed meaning:\n * - shouldComponentUpdate read `this.input.mathField.latex()`, which throws now\n * (and the field loads asynchronously, so `this.input` can be null)\n * - the mixed-number workaround poked `__controller.cursor`, a MathQuill\n * internal with no MathLive equivalent\n * - onClick routes keypad presses through the imperative field API\n */\ndescribe('EditorAndPad after the MathLive migration', () => {\n const props = (over = {}) => ({ classes: {}, classNames: {}, onChange: jest.fn(), ...over });\n\n describe('shouldComponentUpdate', () => {\n it('treats a missing input ref as different, so the first render is not skipped', () => {\n const c = new EditorAndPad(props({ latex: 'x' }));\n\n c.input = null;\n\n expect(c.shouldComponentUpdate({ latex: 'x' }, {})).toBe(true);\n });\n\n it('does not throw when the math engine has not loaded yet', () => {\n const c = new EditorAndPad(props({ latex: 'x' }));\n\n // latex() returns '' until MathLive is ready\n c.input = { latex: () => '' };\n\n expect(() => c.shouldComponentUpdate({ latex: 'x' }, {})).not.toThrow();\n expect(c.shouldComponentUpdate({ latex: 'x' }, {})).toBe(true);\n });\n\n it('skips the update when the field already holds the incoming latex', () => {\n const c = new EditorAndPad(props({ latex: 'x', keypadMode: 'a', noDecimal: false }));\n\n c.input = { latex: () => 'x' };\n c.state = { equationEditor: 'geometry' };\n\n expect(c.shouldComponentUpdate({ latex: 'x', keypadMode: 'a', noDecimal: false }, c.state)).toBe(false);\n });\n\n it('re-renders when the field differs from the incoming latex', () => {\n const c = new EditorAndPad(props({ latex: 'y' }));\n\n c.input = { latex: () => 'x' };\n\n expect(c.shouldComponentUpdate({ latex: 'y' }, {})).toBe(true);\n });\n\n it('uses input.latex(), never input.mathField.latex()', () => {\n const c = new EditorAndPad(props({ latex: 'x' }));\n const latex = jest.fn(() => 'x');\n\n // deliberately no `mathField` - the old code would have thrown here\n c.input = { latex };\n c.state = { equationEditor: 'geometry' };\n c.shouldComponentUpdate({ latex: 'x' }, c.state);\n\n expect(latex).toHaveBeenCalled();\n });\n });\n\n describe('onClick key routing', () => {\n const withInput = (over = {}) => {\n const c = new EditorAndPad(props(over));\n const calls = { write: [], command: [], keystroke: [], clear: 0 };\n\n c.input = {\n write: (v) => calls.write.push(v),\n command: (v) => calls.command.push(v),\n keystroke: (v) => calls.keystroke.push(v),\n clear: () => calls.clear++,\n };\n c.updateDisable = () => {};\n\n return { c, calls };\n };\n\n // toNodeData keys this off `value === 'clear'`, not `type`\n it('clear', () => {\n const { c, calls } = withInput();\n\n c.onClick({ value: 'clear' });\n expect(calls.clear).toBe(1);\n });\n\n it('command', () => {\n const { c, calls } = withInput();\n\n c.onClick({ type: 'command', value: '\\\\frac' });\n expect(calls.command).toEqual(['\\\\frac']);\n });\n\n it('cursor keystroke', () => {\n const { c, calls } = withInput();\n\n c.onClick({ type: 'cursor', value: 'Left' });\n expect(calls.keystroke).toEqual(['Left']);\n });\n\n it('answer block writes the response token', () => {\n const { c, calls } = withInput();\n\n c.onClick({ type: 'answer' });\n expect(calls.write).toEqual(['%response%']);\n });\n\n it('plain value', () => {\n const { c, calls } = withInput();\n\n c.onClick({ value: 'x' });\n expect(calls.write).toEqual(['x']);\n });\n\n it('ignores a nullish key', () => {\n const { c, calls } = withInput();\n\n expect(() => c.onClick(null)).not.toThrow();\n expect(calls.write).toEqual([]);\n });\n });\n\n describe('onEditorChange', () => {\n const withInput = (over = {}) => {\n const onChange = jest.fn();\n const c = new EditorAndPad(props({ onChange, ...over }));\n const calls = { keystroke: [], clear: 0, write: [] };\n\n c.input = {\n keystroke: (v) => calls.keystroke.push(v),\n clear: () => calls.clear++,\n write: (v) => calls.write.push(v),\n };\n c.updateDisable = () => {};\n\n return { c, onChange, calls };\n };\n\n it('propagates ordinary latex to onChange', () => {\n const { c, onChange } = withInput();\n\n c.onEditorChange('\\\\frac{1}{2}');\n expect(onChange).toHaveBeenCalledWith('\\\\frac{1}{2}');\n });\n\n it('strips decimals when noDecimal is set', () => {\n const { c, onChange, calls } = withInput({ noDecimal: true });\n\n c.onEditorChange('1.5');\n\n expect(calls.clear).toBe(1);\n expect(calls.write).toEqual(['15']);\n expect(onChange).not.toHaveBeenCalled();\n });\n\n it('undoes the empty fraction after a digit with a public delete, not MathQuill internals', () => {\n const { c, onChange, calls } = withInput();\n\n // the shape the old __controller hack targeted\n c.onEditorChange('2\\\\ \\\\frac{1}{ }');\n\n expect(calls.keystroke).toEqual(['Backspace']);\n expect(onChange).not.toHaveBeenCalled();\n });\n\n it('does not treat normal fractions as the mixed-number case', () => {\n const { c, onChange, calls } = withInput();\n\n c.onEditorChange('\\\\frac{1}{2}');\n\n expect(calls.keystroke).toEqual([]);\n expect(onChange).toHaveBeenCalled();\n });\n });\n});\n"],"mappings":";;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAiD,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,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C;MAC3BF,MAAM,CAACW,KAAK,CAACC,KAAK,CAAC,CAACW,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;MACnCvB,MAAM,CAACR,QAAQ,CAAC,CAACW,GAAG,CAACM,gBAAgB,CAAC,CAAC;IACzC,CAAC,CAAC;IAEFd,EAAE,CAAC,uFAAuF,EAAE,YAAM;MAChG,IAAAqC,WAAA,GAA+BtB,SAAS,CAAC,CAAC;QAAlCd,CAAC,GAAAoC,WAAA,CAADpC,CAAC;QAAEJ,QAAQ,GAAAwC,WAAA,CAARxC,QAAQ;QAAEmB,KAAK,GAAAqB,WAAA,CAALrB,KAAK;;MAE1B;MACAf,CAAC,CAACiC,cAAc,CAAC,kBAAkB,CAAC;MAEpC7B,MAAM,CAACW,KAAK,CAACG,SAAS,CAAC,CAACS,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;MAC9CvB,MAAM,CAACR,QAAQ,CAAC,CAACW,GAAG,CAACM,gBAAgB,CAAC,CAAC;IACzC,CAAC,CAAC;IAEFd,EAAE,CAAC,0DAA0D,EAAE,YAAM;MACnE,IAAAsC,WAAA,GAA+BvB,SAAS,CAAC,CAAC;QAAlCd,CAAC,GAAAqC,WAAA,CAADrC,CAAC;QAAEJ,QAAQ,GAAAyC,WAAA,CAARzC,QAAQ;QAAEmB,KAAK,GAAAsB,WAAA,CAALtB,KAAK;MAE1Bf,CAAC,CAACiC,cAAc,CAAC,cAAc,CAAC;MAEhC7B,MAAM,CAACW,KAAK,CAACG,SAAS,CAAC,CAACS,OAAO,CAAC,EAAE,CAAC;MACnCvB,MAAM,CAACR,QAAQ,CAAC,CAACiB,gBAAgB,CAAC,CAAC;IACrC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
5
- var _editorAndPad = require("../editor-and-pad");
6
- var _react = require("@testing-library/react");
7
- var _react2 = _interopRequireDefault(require("react"));
8
- 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; }
9
- 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; }
10
- describe('EditorAndPad', function () {
11
- var defaultProps = {
12
- classes: {},
13
- classNames: {},
14
- onBlur: jest.fn()
15
- };
16
- beforeEach(function () {
17
- jest.useFakeTimers();
18
- });
19
- afterEach(function () {
20
- jest.useRealTimers();
21
- });
22
- it('renders with default props', function () {
23
- var _render = (0, _react.render)(/*#__PURE__*/_react2["default"].createElement(_editorAndPad.EditorAndPad, defaultProps)),
24
- container = _render.container;
25
- expect(container.firstChild).toBeInTheDocument();
26
- });
27
- describe('autoFocus', function () {
28
- it('focuses input immediately via setTimeout when autoFocus is true', function () {
29
- var mockFocus = jest.fn();
30
- var component = new _editorAndPad.EditorAndPad(_objectSpread(_objectSpread({}, defaultProps), {}, {
31
- autoFocus: true
32
- }));
33
- component.input = {
34
- focus: mockFocus
35
- };
36
- component.componentDidMount();
37
- expect(mockFocus).not.toHaveBeenCalled();
38
- jest.runAllTimers();
39
- expect(mockFocus).toHaveBeenCalledTimes(1);
40
- });
41
- it('does not focus input when autoFocus is false', function () {
42
- var mockFocus = jest.fn();
43
- var component = new _editorAndPad.EditorAndPad(_objectSpread(_objectSpread({}, defaultProps), {}, {
44
- autoFocus: false
45
- }));
46
- component.input = {
47
- focus: mockFocus
48
- };
49
- component.componentDidMount();
50
- jest.runAllTimers();
51
- expect(mockFocus).not.toHaveBeenCalled();
52
- });
53
- it('does not focus when input ref is not set', function () {
54
- var component = new _editorAndPad.EditorAndPad(_objectSpread(_objectSpread({}, defaultProps), {}, {
55
- autoFocus: true
56
- }));
57
- component.input = null;
58
- expect(function () {
59
- component.componentDidMount();
60
- jest.runAllTimers();
61
- }).not.toThrow();
62
- });
63
- it('uses setTimeout with 0ms delay to defer focus', function () {
64
- var setTimeoutSpy = jest.spyOn(global, 'setTimeout');
65
- var mockFocus = jest.fn();
66
- var component = new _editorAndPad.EditorAndPad(_objectSpread(_objectSpread({}, defaultProps), {}, {
67
- autoFocus: true
68
- }));
69
- component.input = {
70
- focus: mockFocus
71
- };
72
- component.componentDidMount();
73
- expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 0);
74
- setTimeoutSpy.mockRestore();
75
- });
76
- });
77
- });
78
- //# sourceMappingURL=editor-and-pad.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-and-pad.test.js","names":["_editorAndPad","require","_react","_react2","_interopRequireDefault","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","describe","defaultProps","classes","classNames","onBlur","jest","fn","beforeEach","useFakeTimers","afterEach","useRealTimers","it","_render","render","createElement","EditorAndPad","container","expect","firstChild","toBeInTheDocument","mockFocus","component","autoFocus","input","focus","componentDidMount","not","toHaveBeenCalled","runAllTimers","toHaveBeenCalledTimes","toThrow","setTimeoutSpy","spyOn","global","toHaveBeenCalledWith","any","Function","mockRestore"],"sources":["../../src/__tests__/editor-and-pad.test.js"],"sourcesContent":["import { EditorAndPad } from '../editor-and-pad';\nimport { render } from '@testing-library/react';\nimport React from 'react';\n\ndescribe('EditorAndPad', () => {\n const defaultProps = {\n classes: {},\n classNames: {},\n onBlur: jest.fn(),\n };\n\n beforeEach(() => {\n jest.useFakeTimers();\n });\n\n afterEach(() => {\n jest.useRealTimers();\n });\n\n it('renders with default props', () => {\n const { container } = render(<EditorAndPad {...defaultProps} />);\n expect(container.firstChild).toBeInTheDocument();\n });\n\n describe('autoFocus', () => {\n it('focuses input immediately via setTimeout when autoFocus is true', () => {\n const mockFocus = jest.fn();\n const component = new EditorAndPad({ ...defaultProps, autoFocus: true });\n component.input = { focus: mockFocus };\n\n component.componentDidMount();\n\n expect(mockFocus).not.toHaveBeenCalled();\n\n jest.runAllTimers();\n\n expect(mockFocus).toHaveBeenCalledTimes(1);\n });\n\n it('does not focus input when autoFocus is false', () => {\n const mockFocus = jest.fn();\n const component = new EditorAndPad({ ...defaultProps, autoFocus: false });\n component.input = { focus: mockFocus };\n\n component.componentDidMount();\n jest.runAllTimers();\n\n expect(mockFocus).not.toHaveBeenCalled();\n });\n\n it('does not focus when input ref is not set', () => {\n const component = new EditorAndPad({ ...defaultProps, autoFocus: true });\n component.input = null;\n\n expect(() => {\n component.componentDidMount();\n jest.runAllTimers();\n }).not.toThrow();\n });\n\n it('uses setTimeout with 0ms delay to defer focus', () => {\n const setTimeoutSpy = jest.spyOn(global, 'setTimeout');\n const mockFocus = jest.fn();\n const component = new EditorAndPad({ ...defaultProps, autoFocus: true });\n component.input = { focus: mockFocus };\n\n component.componentDidMount();\n\n expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 0);\n\n setTimeoutSpy.mockRestore();\n });\n });\n});\n"],"mappings":";;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA0B,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBA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CAAC;IAC1C,CAAC,CAAC;IAEFhB,EAAE,CAAC,0CAA0C,EAAE,YAAM;MACnD,IAAMU,SAAS,GAAG,IAAIN,0BAAY,CAAAvB,aAAA,CAAAA,aAAA,KAAMS,YAAY;QAAEqB,SAAS,EAAE;MAAI,EAAE,CAAC;MACxED,SAAS,CAACE,KAAK,GAAG,IAAI;MAEtBN,MAAM,CAAC,YAAM;QACXI,SAAS,CAACI,iBAAiB,CAAC,CAAC;QAC7BpB,IAAI,CAACuB,YAAY,CAAC,CAAC;MACrB,CAAC,CAAC,CAACF,GAAG,CAACI,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;IAEFnB,EAAE,CAAC,+CAA+C,EAAE,YAAM;MACxD,IAAMoB,aAAa,GAAG1B,IAAI,CAAC2B,KAAK,CAACC,MAAM,EAAE,YAAY,CAAC;MACtD,IAAMb,SAAS,GAAGf,IAAI,CAACC,EAAE,CAAC,CAAC;MAC3B,IAAMe,SAAS,GAAG,IAAIN,0BAAY,CAAAvB,aAAA,CAAAA,aAAA,KAAMS,YAAY;QAAEqB,SAAS,EAAE;MAAI,EAAE,CAAC;MACxED,SAAS,CAACE,KAAK,GAAG;QAAEC,KAAK,EAAEJ;MAAU,CAAC;MAEtCC,SAAS,CAACI,iBAAiB,CAAC,CAAC;MAE7BR,MAAM,CAACc,aAAa,CAAC,CAACG,oBAAoB,CAACjB,MAAM,CAACkB,GAAG,CAACC,QAAQ,CAAC,EAAE,CAAC,CAAC;MAEnEL,aAAa,CAACM,WAAW,CAAC,CAAC;IAC7B,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
5
- var _index = require("../index");
6
- var _react = require("@testing-library/react");
7
- var _react2 = _interopRequireDefault(require("react"));
8
- describe('RawPureToolbar', function () {
9
- var defaultProps = {
10
- classes: {},
11
- controlledKeypad: true,
12
- showKeypad: true
13
- };
14
- it('renders with DONE button if hideDoneButton is not defined', function () {
15
- var _render = (0, _react.render)(/*#__PURE__*/_react2["default"].createElement(_index.RawPureToolbar, defaultProps)),
16
- container = _render.container;
17
- expect(container.firstChild).toBeInTheDocument();
18
- });
19
- it('renders without DONE button if hideDoneButton value is true', function () {
20
- var _render2 = (0, _react.render)(/*#__PURE__*/_react2["default"].createElement(_index.RawPureToolbar, (0, _extends2["default"])({}, defaultProps, {
21
- hideDoneButton: true
22
- }))),
23
- container = _render2.container;
24
- expect(container.firstChild).toBeInTheDocument();
25
- });
26
- });
27
- //# sourceMappingURL=index.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.js","names":["_index","require","_react","_react2","_interopRequireDefault","describe","defaultProps","classes","controlledKeypad","showKeypad","it","_render","render","createElement","RawPureToolbar","container","expect","firstChild","toBeInTheDocument","_render2","_extends2","hideDoneButton"],"sources":["../../src/__tests__/index.test.js"],"sourcesContent":["import { RawPureToolbar } from '../index';\nimport { render } from '@testing-library/react';\nimport React from 'react';\n\ndescribe('RawPureToolbar', () => {\n const defaultProps = {\n classes: {},\n controlledKeypad: true,\n showKeypad: true,\n };\n\n it('renders with DONE button if hideDoneButton is not defined', () => {\n const { container } = render(<RawPureToolbar {...defaultProps} />);\n expect(container.firstChild).toBeInTheDocument();\n });\n\n it('renders without DONE button if hideDoneButton value is true', () => {\n const { container } = render(<RawPureToolbar {...defaultProps} hideDoneButton={true} />);\n expect(container.firstChild).toBeInTheDocument();\n });\n});\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEAI,QAAQ,CAAC,gBAAgB,EAAE,YAAM;EAC/B,IAAMC,YAAY,GAAG;IACnBC,OAAO,EAAE,CAAC,CAAC;IACXC,gBAAgB,EAAE,IAAI;IACtBC,UAAU,EAAE;EACd,CAAC;EAEDC,EAAE,CAAC,2DAA2D,EAAE,YAAM;IACpE,IAAAC,OAAA,GAAsB,IAAAC,aAAM,eAACT,OAAA,YAAAU,aAAA,CAACb,MAAA,CAAAc,cAAc,EAAKR,YAAe,CAAC,CAAC;MAA1DS,SAAS,GAAAJ,OAAA,CAATI,SAAS;IACjBC,MAAM,CAACD,SAAS,CAACE,UAAU,CAAC,CAACC,iBAAiB,CAAC,CAAC;EAClD,CAAC,CAAC;EAEFR,EAAE,CAAC,6DAA6D,EAAE,YAAM;IACtE,IAAAS,QAAA,GAAsB,IAAAP,aAAM,eAACT,OAAA,YAAAU,aAAA,CAACb,MAAA,CAAAc,cAAc,MAAAM,SAAA,iBAAKd,YAAY;QAAEe,cAAc,EAAE;MAAK,EAAE,CAAC,CAAC;MAAhFN,SAAS,GAAAI,QAAA,CAATJ,SAAS;IACjBC,MAAM,CAACD,SAAS,CAACE,UAAU,CAAC,CAACC,iBAAiB,CAAC,CAAC;EAClD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
5
- var _react = _interopRequireDefault(require("react"));
6
- var _react2 = require("@testing-library/react");
7
- var _mathPreview = _interopRequireDefault(require("../math-preview"));
8
- /** Every rule emotion has injected so far, as CSSStyleRule objects. */
9
- var injectedRules = function injectedRules() {
10
- return Array.from(document.querySelectorAll('style[data-emotion]')).flatMap(function (tag) {
11
- return tag.sheet ? Array.from(tag.sheet.cssRules) : [];
12
- }).filter(function (rule) {
13
- return rule.selectorText;
14
- });
15
- };
16
-
17
- /**
18
- * The `.ML__latex` rule that actually applies to `element`.
19
- *
20
- * Matching with `element.matches` rather than string comparison means the
21
- * assertions cover the selector too: a rule written as `& > .ML__latex` would
22
- * not match the nested markup MathLive emits, and these tests would fail.
23
- */
24
- var mathLiveRuleFor = function mathLiveRuleFor(element) {
25
- return injectedRules().find(function (rule) {
26
- return rule.selectorText.includes('.ML__latex') && element.matches(rule.selectorText);
27
- });
28
- };
29
-
30
- /**
31
- * Stand in for MathLive's `convertLatexToMarkup` output, which is
32
- * `<span class="ML__latex">...</span>` nested inside `mf.Static`'s holder span.
33
- * MathLive does not load under jsdom, so the markup is added by hand.
34
- */
35
- var addStaticMarkup = function addStaticMarkup(container) {
36
- var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
37
- var parent = container.firstChild;
38
- for (var i = 1; i < depth; i += 1) {
39
- var wrapper = document.createElement('span');
40
- parent.appendChild(wrapper);
41
- parent = wrapper;
42
- }
43
- var markup = document.createElement('span');
44
- markup.className = 'ML__latex';
45
- parent.appendChild(markup);
46
- return markup;
47
- };
48
- describe('MathPreview', function () {
49
- var defaultProps = {
50
- latex: 'sqrt(5)',
51
- classes: {},
52
- isSelected: false,
53
- onFocus: jest.fn(),
54
- onBlur: jest.fn()
55
- };
56
- it('renders with default props', function () {
57
- var _render = (0, _react2.render)(/*#__PURE__*/_react["default"].createElement(_mathPreview["default"], defaultProps)),
58
- container = _render.container;
59
- expect(container.firstChild).toBeInTheDocument();
60
- });
61
- describe('MathLive static markup', function () {
62
- it('is outlined and padded when not selected', function () {
63
- var _render2 = (0, _react2.render)(/*#__PURE__*/_react["default"].createElement(_mathPreview["default"], (0, _extends2["default"])({}, defaultProps, {
64
- isSelected: false
65
- }))),
66
- container = _render2.container;
67
- var rule = mathLiveRuleFor(addStaticMarkup(container));
68
- expect(rule).toBeDefined();
69
- expect(rule.style.getPropertyValue('border')).toEqual('solid 1px lightgrey');
70
- expect(rule.style.getPropertyValue('padding')).toEqual('5px');
71
- });
72
- it('drops its outline and padding when selected, so only the container border shows', function () {
73
- var _render3 = (0, _react2.render)(/*#__PURE__*/_react["default"].createElement(_mathPreview["default"], (0, _extends2["default"])({}, defaultProps, {
74
- isSelected: true
75
- }))),
76
- container = _render3.container;
77
- var rule = mathLiveRuleFor(addStaticMarkup(container));
78
- expect(rule).toBeDefined();
79
- expect(rule.style.getPropertyValue('border')).toEqual('solid 0px lightgrey');
80
- expect(rule.style.getPropertyValue('padding')).toEqual('0px');
81
- });
82
- it('is styled at any depth below the container, not just as a direct child', function () {
83
- var _render4 = (0, _react2.render)(/*#__PURE__*/_react["default"].createElement(_mathPreview["default"], (0, _extends2["default"])({}, defaultProps, {
84
- isSelected: false
85
- }))),
86
- container = _render4.container;
87
- expect(mathLiveRuleFor(addStaticMarkup(container, 3))).toBeDefined();
88
- });
89
- });
90
- });
91
- //# sourceMappingURL=math-preview.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math-preview.test.js","names":["_react","_interopRequireDefault","require","_react2","_mathPreview","injectedRules","Array","from","document","querySelectorAll","flatMap","tag","sheet","cssRules","filter","rule","selectorText","mathLiveRuleFor","element","find","includes","matches","addStaticMarkup","container","depth","arguments","length","undefined","parent","firstChild","i","wrapper","createElement","appendChild","markup","className","describe","defaultProps","latex","classes","isSelected","onFocus","jest","fn","onBlur","it","_render","render","expect","toBeInTheDocument","_render2","_extends2","toBeDefined","style","getPropertyValue","toEqual","_render3","_render4"],"sources":["../../src/__tests__/math-preview.test.js"],"sourcesContent":["import React from 'react';\nimport { render } from '@testing-library/react';\nimport MathPreview from '../math-preview';\n\n/** Every rule emotion has injected so far, as CSSStyleRule objects. */\nconst injectedRules = () =>\n Array.from(document.querySelectorAll('style[data-emotion]'))\n .flatMap((tag) => (tag.sheet ? Array.from(tag.sheet.cssRules) : []))\n .filter((rule) => rule.selectorText);\n\n/**\n * The `.ML__latex` rule that actually applies to `element`.\n *\n * Matching with `element.matches` rather than string comparison means the\n * assertions cover the selector too: a rule written as `& > .ML__latex` would\n * not match the nested markup MathLive emits, and these tests would fail.\n */\nconst mathLiveRuleFor = (element) =>\n injectedRules().find((rule) => rule.selectorText.includes('.ML__latex') && element.matches(rule.selectorText));\n\n/**\n * Stand in for MathLive's `convertLatexToMarkup` output, which is\n * `<span class=\"ML__latex\">...</span>` nested inside `mf.Static`'s holder span.\n * MathLive does not load under jsdom, so the markup is added by hand.\n */\nconst addStaticMarkup = (container, depth = 1) => {\n let parent = container.firstChild;\n\n for (let i = 1; i < depth; i += 1) {\n const wrapper = document.createElement('span');\n\n parent.appendChild(wrapper);\n parent = wrapper;\n }\n\n const markup = document.createElement('span');\n\n markup.className = 'ML__latex';\n parent.appendChild(markup);\n\n return markup;\n};\n\ndescribe('MathPreview', () => {\n const defaultProps = {\n latex: 'sqrt(5)',\n classes: {},\n isSelected: false,\n onFocus: jest.fn(),\n onBlur: jest.fn(),\n };\n\n it('renders with default props', () => {\n const { container } = render(<MathPreview {...defaultProps} />);\n expect(container.firstChild).toBeInTheDocument();\n });\n\n describe('MathLive static markup', () => {\n it('is outlined and padded when not selected', () => {\n const { container } = render(<MathPreview {...defaultProps} isSelected={false} />);\n const rule = mathLiveRuleFor(addStaticMarkup(container));\n\n expect(rule).toBeDefined();\n expect(rule.style.getPropertyValue('border')).toEqual('solid 1px lightgrey');\n expect(rule.style.getPropertyValue('padding')).toEqual('5px');\n });\n\n it('drops its outline and padding when selected, so only the container border shows', () => {\n const { container } = render(<MathPreview {...defaultProps} isSelected />);\n const rule = mathLiveRuleFor(addStaticMarkup(container));\n\n expect(rule).toBeDefined();\n expect(rule.style.getPropertyValue('border')).toEqual('solid 0px lightgrey');\n expect(rule.style.getPropertyValue('padding')).toEqual('0px');\n });\n\n it('is styled at any depth below the container, not just as a direct child', () => {\n const { container } = render(<MathPreview {...defaultProps} isSelected={false} />);\n\n expect(mathLiveRuleFor(addStaticMarkup(container, 3))).toBeDefined();\n });\n });\n});\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;AACA,IAAMG,aAAa,GAAG,SA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AC;IAC/D,CAAC,CAAC;IAEFV,EAAE,CAAC,iFAAiF,EAAE,YAAM;MAC1F,IAAAW,QAAA,GAAsB,IAAAT,cAAM,eAAC/C,MAAA,YAAAgC,aAAA,CAAC5B,YAAA,WAAW,MAAA+C,SAAA,iBAAKd,YAAY;UAAEG,UAAU;QAAA,EAAE,CAAC,CAAC;QAAlEjB,SAAS,GAAAiC,QAAA,CAATjC,SAAS;MACjB,IAAMR,IAAI,GAAGE,eAAe,CAACK,eAAe,CAACC,SAAS,CAAC,CAAC;MAExDyB,MAAM,CAACjC,IAAI,CAAC,CAACqC,WAAW,CAAC,CAAC;MAC1BJ,MAAM,CAACjC,IAAI,CAACsC,KAAK,CAACC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,qBAAqB,CAAC;MAC5EP,MAAM,CAACjC,IAAI,CAACsC,KAAK,CAACC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAACC,OAAO,CAAC,KAAK,CAAC;IAC/D,CAAC,CAAC;IAEFV,EAAE,CAAC,wEAAwE,EAAE,YAAM;MACjF,IAAAY,QAAA,GAAsB,IAAAV,cAAM,eAAC/C,MAAA,YAAAgC,aAAA,CAAC5B,YAAA,WAAW,MAAA+C,SAAA,iBAAKd,YAAY;UAAEG,UAAU,EAAE;QAAM,EAAE,CAAC,CAAC;QAA1EjB,SAAS,GAAAkC,QAAA,CAATlC,SAAS;MAEjByB,MAAM,CAAC/B,eAAe,CAACK,eAAe,CAACC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC6B,WAAW,CAAC,CAAC;IACtE,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,51 +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.RawDoneButton = exports.DoneButton = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
11
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
12
- var _styles = require("@mui/material/styles");
13
- var _propTypes = _interopRequireDefault(require("prop-types"));
14
- 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; }
15
- 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; }
16
- var StyledIconButton = (0, _styles.styled)(_IconButton["default"])(function (_ref) {
17
- var theme = _ref.theme,
18
- hideBackground = _ref.hideBackground;
19
- return _objectSpread(_objectSpread({
20
- verticalAlign: 'top',
21
- width: '28px',
22
- height: '28px',
23
- color: '#00bb00'
24
- }, hideBackground && {
25
- backgroundColor: theme.palette.common.white,
26
- '&:hover': {
27
- backgroundColor: theme.palette.grey[200]
28
- }
29
- }), {}, {
30
- '& .MuiIconButton-label': {
31
- position: 'absolute',
32
- top: '2px'
33
- }
34
- });
35
- });
36
- var RawDoneButton = exports.RawDoneButton = function RawDoneButton(_ref2) {
37
- var onClick = _ref2.onClick,
38
- hideBackground = _ref2.hideBackground;
39
- return /*#__PURE__*/_react["default"].createElement(StyledIconButton, {
40
- "aria-label": "Done",
41
- onClick: onClick,
42
- hideBackground: hideBackground,
43
- size: "large"
44
- }, /*#__PURE__*/_react["default"].createElement(_Check["default"], null));
45
- };
46
- RawDoneButton.propTypes = {
47
- onClick: _propTypes["default"].func,
48
- hideBackground: _propTypes["default"].bool
49
- };
50
- var DoneButton = exports.DoneButton = RawDoneButton;
51
- //# sourceMappingURL=done-button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"done-button.js","names":["_react","_interopRequireDefault","require","_IconButton","_Check","_styles","_propTypes","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","StyledIconButton","styled","IconButton","_ref","theme","hideBackground","verticalAlign","width","height","color","backgroundColor","palette","common","white","grey","position","top","RawDoneButton","exports","_ref2","onClick","createElement","size","propTypes","PropTypes","func","bool","DoneButton"],"sources":["../src/done-button.jsx"],"sourcesContent":["import React from 'react';\n\nimport IconButton from '@mui/material/IconButton';\nimport Check from '@mui/icons-material/Check';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\n\nconst StyledIconButton = styled(IconButton)(({ theme, hideBackground }) => ({\n verticalAlign: 'top',\n width: '28px',\n height: '28px',\n color: '#00bb00',\n ...(hideBackground && {\n backgroundColor: theme.palette.common.white,\n '&:hover': {\n backgroundColor: theme.palette.grey[200],\n },\n }),\n '& .MuiIconButton-label': {\n position: 'absolute',\n top: '2px',\n },\n}));\n\nexport const RawDoneButton = ({ onClick, hideBackground }) => (\n <StyledIconButton aria-label=\"Done\" onClick={onClick} hideBackground={hideBackground} size=\"large\">\n <Check />\n </StyledIconButton>\n);\n\nRawDoneButton.propTypes = {\n onClick: PropTypes.func,\n hideBackground: PropTypes.bool,\n};\n\nexport const DoneButton = RawDoneButton;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,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