@pie-element/charting 5.11.3 → 6.0.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,6 @@ The schema defines the following properties:
6
6
 
7
7
  Indicates if user can add more categories
8
8
 
9
- # `categoryDefaultLabel` (string, required)
10
-
11
- Indicates default value for a new category's label
12
-
13
9
  # `chartType` (string, enum, required)
14
10
 
15
11
  This element must be one of the following enum values:
@@ -170,6 +166,22 @@ Indicates if Teacher Instructions are enabled
170
166
 
171
167
  Indicates if Rubric is enabled
172
168
 
169
+ # `changeInteractiveEnabled` (boolean, required)
170
+
171
+ Indicates if teacher can enable/disable data[]:interactive
172
+
173
+ # `changeEditableEnabled` (boolean, required)
174
+
175
+ Indicates if teacher can enable/disable data[]:editable
176
+
177
+ # `changeAddCategoryEnabled` (boolean, required)
178
+
179
+ Indicates if teacher can enable/disable addCategoryEnabled
180
+
181
+ # `studentNewCategoryDefaultLabel` (string, required)
182
+
183
+ Label for new category in correct response and player's chart
184
+
173
185
  # `id` (string, required)
174
186
 
175
187
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -246,6 +258,26 @@ Indicates the label for the item that has to be displayed in the Settings Panel
246
258
  Indicates the value of the item if it affects config-ui
247
259
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
248
260
 
261
+ ## `AuthorNewCategoryDefaults` (object)
262
+
263
+ Properties of the `AuthorNewCategoryDefaults` object:
264
+
265
+ ### `settings` (boolean)
266
+
267
+ Indicates if the item has to be displayed in the Settings Panel
268
+
269
+ ### `label` (string)
270
+
271
+ Indicates the label for the new category
272
+
273
+ ### `interactive` (boolean)
274
+
275
+ Indicates if new category is interactive
276
+
277
+ ### `editable` (boolean)
278
+
279
+ Indicates if new category is editable
280
+
249
281
  ## `ConfigureMaxImageDimensionsProp` (object)
250
282
 
251
283
  Properties of the `ConfigureMaxImageDimensionsProp` object:
@@ -262,6 +294,102 @@ Indicates the max dimension for images in prompt - this is also the default dime
262
294
 
263
295
  Indicates the max dimension for images in rationale
264
296
 
297
+ ## `ChartingOptions` (object)
298
+
299
+ Properties of the `ChartingOptions` object:
300
+
301
+ ### `changeInteractive` (object)
302
+
303
+ Properties of the `changeInteractive` object:
304
+
305
+ #### `settings` (boolean)
306
+
307
+ Indicates if the item has to be displayed in the Settings Panel
308
+
309
+ #### `authoringLabel` (string)
310
+
311
+ Indicates the label for the option
312
+
313
+ #### `settingsLabel` (string)
314
+
315
+ Indicates the label for the item that has to be displayed in the Settings Panel
316
+
317
+ ### `changeEditable` (object)
318
+
319
+ Properties of the `changeEditable` object:
320
+
321
+ #### `settings` (boolean)
322
+
323
+ Indicates if the item has to be displayed in the Settings Panel
324
+
325
+ #### `authoringLabel` (string)
326
+
327
+ Indicates the label for the option
328
+
329
+ #### `settingsLabel` (string)
330
+
331
+ Indicates the label for the item that has to be displayed in the Settings Panel
332
+
333
+ ### `addCategory` (object)
334
+
335
+ Properties of the `addCategory` object:
336
+
337
+ #### `settings` (boolean)
338
+
339
+ Indicates if the item has to be displayed in the Settings Panel
340
+
341
+ #### `authoringLabel` (string)
342
+
343
+ Indicates the label for the option
344
+
345
+ #### `settingsLabel` (string)
346
+
347
+ Indicates the label for the item that has to be displayed in the Settings Panel
348
+
349
+ ## `ChartingOption` (object)
350
+
351
+ Properties of the `ChartingOption` object:
352
+
353
+ ### `settings` (boolean)
354
+
355
+ Indicates if the item has to be displayed in the Settings Panel
356
+
357
+ ### `authoringLabel` (string)
358
+
359
+ Indicates the label for the option
360
+
361
+ ### `settingsLabel` (string)
362
+
363
+ Indicates the label for the item that has to be displayed in the Settings Panel
364
+
365
+ ## `AvailableChartTypes` (object)
366
+
367
+ Properties of the `AvailableChartTypes` object:
368
+
369
+ ### `bar` (string, required)
370
+
371
+ Indicates if bar chart is available and the label used for it.
372
+
373
+ ### `histogram` (string, required)
374
+
375
+ Indicates if histogram is available and the label used for it.
376
+
377
+ ### `lineDot` (string, required)
378
+
379
+ Indicates if line chart with dots is available and the label used for it.
380
+
381
+ ### `lineCross` (string, required)
382
+
383
+ Indicates if line chart with crosses is available and the label used for it.
384
+
385
+ ### `dotPlot` (string, required)
386
+
387
+ Indicates if dot plot is available and the label used for it.
388
+
389
+ ### `linePlot` (string, required)
390
+
391
+ Indicates if line plot is available and the label used for it.
392
+
265
393
  ## `Answer` (object)
266
394
 
267
395
  Properties of the `Answer` object:
@@ -292,7 +420,7 @@ Indicates category value
292
420
 
293
421
  ### `interactive` (boolean, required)
294
422
 
295
- Indicates if category label & value are interactive
423
+ Indicates if category value is interactive
296
424
 
297
425
  ### `editable` (boolean, required)
298
426
 
package/lib/main.js CHANGED
@@ -91,7 +91,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
91
91
  range = model.range,
92
92
  title = model.title,
93
93
  addCategoryEnabled = model.addCategoryEnabled,
94
- categoryDefaultLabel = model.categoryDefaultLabel,
94
+ studentNewCategoryDefaultLabel = model.studentNewCategoryDefaultLabel,
95
95
  rationale = model.rationale,
96
96
  correctedAnswer = model.correctedAnswer,
97
97
  correctAnswer = model.correctAnswer;
@@ -130,7 +130,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
130
130
  title: title,
131
131
  onDataChange: this.changeData,
132
132
  addCategoryEnabled: false,
133
- categoryDefaultLabel: categoryDefaultLabel
133
+ categoryDefaultLabel: studentNewCategoryDefaultLabel
134
134
  }) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
135
135
  className: classes.chart,
136
136
  chartType: chartType,
@@ -142,7 +142,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
142
142
  title: title,
143
143
  onDataChange: this.changeData,
144
144
  addCategoryEnabled: addCategoryEnabled,
145
- categoryDefaultLabel: categoryDefaultLabel
145
+ categoryDefaultLabel: studentNewCategoryDefaultLabel
146
146
  }), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
147
147
  labels: {
148
148
  hidden: 'Show Rationale',
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","classes","teacherInstructions","prompt","chartType","size","domain","range","title","addCategoryEnabled","categoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","collapsible","hidden","visible","toggleCorrect","chart","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","nextProps","prevState","newCategories","defaultCategories","nextCategories","React","Component","PropTypes","object","isRequired","func","array","styles","theme","color","text","backgroundColor","background","overflowX","overflowY","marginTop","spacing","unit","marginBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AAUX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,mGAqBN,UAACC,IAAD;AAAA,aACX,MAAKC,QAAL,CACE;AACEC,QAAAA,UAAU,EAAEF;AADd,OADF,EAIE;AAAA,eAAM,MAAKD,KAAL,CAAWI,eAAX,CAA2BH,IAA3B,CAAN;AAAA,OAJF,CADW;AAAA,KArBM;AAAA,sGA6BH,UAACI,cAAD;AAAA,aAAoB,MAAKH,QAAL,CAAc;AAAEG,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAApB;AAAA,KA7BG;AAGjB,UAAKC,KAAL,GAAa;AACXH,MAAAA,UAAU,EAAEH,KAAK,CAACG,UAAN,IAAoBH,KAAK,CAACO,KAAN,CAAYN,IADjC;AAEXI,MAAAA,cAAc,EAAE;AAFL,KAAb;AAHiB;AAOlB;;;;WAwBD,kBAAS;AACP,wBAAuC,KAAKC,KAA5C;AAAA,UAAQH,UAAR,eAAQA,UAAR;AAAA,UAAoBE,cAApB,eAAoBA,cAApB;AACA,wBAA2B,KAAKL,KAAhC;AAAA,UAAQO,KAAR,eAAQA,KAAR;AA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,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzB3B,IAAAA,aAAa,EAAE;AACb4B,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFJ;AAGbC,MAAAA,SAAS,EAAE,QAHE;AAIbC,MAAAA,SAAS,EAAE;AAJE,KADU;AAOzB5B,IAAAA,KAAK,EAAE;AACL6B,MAAAA,SAAS,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAELC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAF9B,KAPkB;AAWzBnC,IAAAA,WAAW,EAAE;AACXoC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB;AAXY,GAAZ;AAAA,CAAf;;eAgBe,wBAAWV,MAAX,EAAmBtD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, hasText, PreviewPrompt } from '@pie-lib/render-ui';\nimport { Chart, chartTypes } from '@pie-lib/charting';\nimport isArray from 'lodash/isArray';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func,\n categories: PropTypes.array,\n };\n\n static defaultProps = { classes: {} };\n\n constructor(props) {\n super(props);\n\n this.state = {\n categories: props.categories || props.model.data,\n showingCorrect: false,\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { categories: newCategories, model: { data: defaultCategories = [] } = {} } = nextProps;\n const { categories } = prevState;\n const nextCategories = isArray(newCategories) ? newCategories : defaultCategories;\n\n if (!isEqual(nextCategories, categories)) {\n return { categories: nextCategories };\n }\n\n return null;\n }\n\n changeData = (data) =>\n this.setState(\n {\n categories: data,\n },\n () => this.props.onAnswersChange(data),\n );\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n render() {\n const { categories, showingCorrect } = this.state;\n const { model, classes } = this.props;\n const {\n teacherInstructions,\n prompt,\n chartType,\n size,\n domain,\n range,\n title,\n addCategoryEnabled,\n categoryDefaultLabel,\n rationale,\n correctedAnswer,\n correctAnswer,\n } = model;\n\n const correctData =\n correctAnswer && correctAnswer.data\n ? correctAnswer.data.map((data) => {\n return {\n ...data,\n interactive: false,\n editable: false,\n };\n })\n : [];\n\n const showToggle = correctData && correctData.length > 0;\n\n return (\n <div className={classes.mainContainer}>\n {teacherInstructions && hasText(teacherInstructions) && (\n <Collapsible\n className={classes.collapsible}\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n )}\n\n {prompt && <PreviewPrompt className=\"prompt\" prompt={prompt} />}\n\n <CorrectAnswerToggle show={showToggle} toggled={showingCorrect} onToggle={this.toggleCorrect} />\n\n {showingCorrect && showToggle ? (\n <Chart\n className={classes.chart}\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctData || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={false}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n ) : (\n <Chart\n className={classes.chart}\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctedAnswer || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={addCategoryEnabled}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n )}\n\n {rationale && hasText(rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n overflowX: 'scroll',\n overflowY: 'hidden',\n },\n chart: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","classes","teacherInstructions","prompt","chartType","size","domain","range","title","addCategoryEnabled","studentNewCategoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","collapsible","hidden","visible","toggleCorrect","chart","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","nextProps","prevState","newCategories","defaultCategories","nextCategories","React","Component","PropTypes","object","isRequired","func","array","styles","theme","color","text","backgroundColor","background","overflowX","overflowY","marginTop","spacing","unit","marginBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AAUX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,mGAqBN,UAACC,IAAD;AAAA,aACX,MAAKC,QAAL,CACE;AACEC,QAAAA,UAAU,EAAEF;AADd,OADF,EAIE;AAAA,eAAM,MAAKD,KAAL,CAAWI,eAAX,CAA2BH,IAA3B,CAAN;AAAA,OAJF,CADW;AAAA,KArBM;AAAA,sGA6BH,UAACI,cAAD;AAAA,aAAoB,MAAKH,QAAL,CAAc;AAAEG,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAApB;AAAA,KA7BG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AP;AACD;;AAED,aAAO,IAAP;AACD;;;EA7BuBC,kBAAMC,S;;;iCAAnBhD,I,eACQ;AACjBS,EAAAA,OAAO,EAAEwC,sBAAUC,MADF;AAEjB1C,EAAAA,KAAK,EAAEyC,sBAAUC,MAAV,CAAiBC,UAFP;AAGjB9C,EAAAA,eAAe,EAAE4C,sBAAUG,IAHV;AAIjBhD,EAAAA,UAAU,EAAE6C,sBAAUI;AAJL,C;iCADRrD,I,kBAQW;AAAES,EAAAA,OAAO,EAAE;AAAX,C;;AAwIxB,IAAM6C,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzB3B,IAAAA,aAAa,EAAE;AACb4B,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFJ;AAGbC,MAAAA,SAAS,EAAE,QAHE;AAIbC,MAAAA,SAAS,EAAE;AAJE,KADU;AAOzB5B,IAAAA,KAAK,EAAE;AACL6B,MAAAA,SAAS,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAELC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAF9B,KAPkB;AAWzBnC,IAAAA,WAAW,EAAE;AACXoC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB;AAXY,GAAZ;AAAA,CAAf;;eAgBe,wBAAWV,MAAX,EAAmBtD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, hasText, PreviewPrompt } from '@pie-lib/render-ui';\nimport { Chart, chartTypes } from '@pie-lib/charting';\nimport isArray from 'lodash/isArray';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func,\n categories: PropTypes.array,\n };\n\n static defaultProps = { classes: {} };\n\n constructor(props) {\n super(props);\n\n this.state = {\n categories: props.categories || props.model.data,\n showingCorrect: false,\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { categories: newCategories, model: { data: defaultCategories = [] } = {} } = nextProps;\n const { categories } = prevState;\n const nextCategories = isArray(newCategories) ? newCategories : defaultCategories;\n\n if (!isEqual(nextCategories, categories)) {\n return { categories: nextCategories };\n }\n\n return null;\n }\n\n changeData = (data) =>\n this.setState(\n {\n categories: data,\n },\n () => this.props.onAnswersChange(data),\n );\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n render() {\n const { categories, showingCorrect } = this.state;\n const { model, classes } = this.props;\n const {\n teacherInstructions,\n prompt,\n chartType,\n size,\n domain,\n range,\n title,\n addCategoryEnabled,\n studentNewCategoryDefaultLabel,\n rationale,\n correctedAnswer,\n correctAnswer,\n } = model;\n\n const correctData =\n correctAnswer && correctAnswer.data\n ? correctAnswer.data.map((data) => {\n return {\n ...data,\n interactive: false,\n editable: false,\n };\n })\n : [];\n\n const showToggle = correctData && correctData.length > 0;\n\n return (\n <div className={classes.mainContainer}>\n {teacherInstructions && hasText(teacherInstructions) && (\n <Collapsible\n className={classes.collapsible}\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n )}\n\n {prompt && <PreviewPrompt className=\"prompt\" prompt={prompt} />}\n\n <CorrectAnswerToggle show={showToggle} toggled={showingCorrect} onToggle={this.toggleCorrect} />\n\n {showingCorrect && showToggle ? (\n <Chart\n className={classes.chart}\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctData || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={false}\n categoryDefaultLabel={studentNewCategoryDefaultLabel}\n />\n ) : (\n <Chart\n className={classes.chart}\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctedAnswer || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={addCategoryEnabled}\n categoryDefaultLabel={studentNewCategoryDefaultLabel}\n />\n )}\n\n {rationale && hasText(rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n overflowX: 'scroll',\n overflowY: 'hidden',\n },\n chart: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "5.11.3",
7
+ "version": "6.0.1-next.0+cb0f807d6",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -13,10 +13,10 @@
13
13
  "dependencies": {
14
14
  "@material-ui/core": "^3.9.2",
15
15
  "@pie-framework/pie-player-events": "^0.1.0",
16
- "@pie-lib/charting": "^5.8.1",
17
- "@pie-lib/correct-answer-toggle": "^2.3.73",
16
+ "@pie-lib/charting": "^5.12.0",
17
+ "@pie-lib/correct-answer-toggle": "^2.3.74",
18
18
  "@pie-lib/math-rendering": "^2.5.14",
19
- "@pie-lib/render-ui": "^4.14.23",
19
+ "@pie-lib/render-ui": "^4.14.24",
20
20
  "classnames": "^2.2.5",
21
21
  "debug": "^4.1.1",
22
22
  "lodash": "^4.17.15",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "author": "",
27
27
  "license": "ISC",
28
- "gitHead": "ade0af22574b20967b15f5ec6ea106a4b84c419f",
28
+ "gitHead": "cb0f807d6cc1af52c65e90c61e60c0a5994432c1",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js"
31
31
  }