@pie-lib/rubric 2.0.4-next.31 → 2.0.4-next.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/authoring.js CHANGED
@@ -1,19 +1,19 @@
1
- import { ConnectedDroppable as e, DragDropContext as t, PublicDraggable as n } from "./node_modules/.bun/@hello-pangea_dnd@18.0.1_d0d44917b9a63a72/node_modules/@hello-pangea/dnd/dist/dnd.esm.js";
2
- import r from "./point-menu.js";
3
- import i from "react";
4
- import a from "prop-types";
5
- import { styled as o } from "@mui/material/styles";
6
- import s from "@mui/material/InputLabel";
7
- import c from "@mui/material/OutlinedInput";
8
- import l from "@mui/material/Select";
9
- import u from "@mui/material/FormControl";
10
- import d from "@mui/material/MenuItem";
11
- import { range as f, takeRight as p, times as m } from "@pie-element/shared-lodash";
12
- import h from "@mui/material/Checkbox";
13
- import g from "@mui/material/FormGroup";
14
- import _ from "@mui/material/FormControlLabel";
15
- import v from "@mui/material/Typography";
16
- import y from "@mui/icons-material/DragIndicator";
1
+ import e from "./point-menu.js";
2
+ import t from "react";
3
+ import n from "prop-types";
4
+ import { styled as r } from "@mui/material/styles";
5
+ import i from "@mui/material/InputLabel";
6
+ import a from "@mui/material/OutlinedInput";
7
+ import o from "@mui/material/Select";
8
+ import s from "@mui/material/FormControl";
9
+ import c from "@mui/material/MenuItem";
10
+ import { range as l, takeRight as u, times as d } from "@pie-element/shared-lodash";
11
+ import f from "@mui/material/Checkbox";
12
+ import p from "@mui/material/FormGroup";
13
+ import m from "@mui/material/FormControlLabel";
14
+ import h from "@mui/material/Typography";
15
+ import g from "@mui/icons-material/DragIndicator";
16
+ import { DragDropContext as _, Draggable as v, Droppable as y } from "@hello-pangea/dnd";
17
17
  import b from "debug";
18
18
  import { jsx as x, jsxs as S } from "react/jsx-runtime";
19
19
  import C from "@pie-lib/editable-html-tip-tap";
@@ -23,63 +23,63 @@ import { grey as T } from "@mui/material/colors";
23
23
  var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
24
24
  let r = Array.from(e), [i] = r.splice(t, 1);
25
25
  return r.splice(n, 0, i), r;
26
- }, O = a.shape({
27
- excludeZero: a.bool,
28
- points: a.arrayOf(a.string),
29
- sampleAnswers: a.arrayOf(a.string),
30
- maxPoints: a.number,
31
- rubriclessInstruction: a.string
26
+ }, O = n.shape({
27
+ excludeZero: n.bool,
28
+ points: n.arrayOf(n.string),
29
+ sampleAnswers: n.arrayOf(n.string),
30
+ maxPoints: n.number,
31
+ rubriclessInstruction: n.string
32
32
  }), k = (e) => {
33
- let { value: t, onChange: n, max: r } = e, i = "max-points-label";
34
- return /* @__PURE__ */ S(u, {
33
+ let { value: t, onChange: n, max: r } = e, u = "max-points-label";
34
+ return /* @__PURE__ */ S(s, {
35
35
  sx: {
36
36
  minWidth: 120,
37
37
  m: 1
38
38
  },
39
39
  variant: "outlined",
40
- children: [/* @__PURE__ */ x(s, {
41
- id: i,
40
+ children: [/* @__PURE__ */ x(i, {
41
+ id: u,
42
42
  children: "Max Points"
43
- }), /* @__PURE__ */ x(l, {
44
- labelId: i,
43
+ }), /* @__PURE__ */ x(o, {
44
+ labelId: u,
45
45
  label: "Max Points",
46
46
  value: t,
47
47
  onChange: (e) => n(e.target.value),
48
- input: /* @__PURE__ */ x(c, { label: "Max Points" }),
48
+ input: /* @__PURE__ */ x(a, { label: "Max Points" }),
49
49
  MenuProps: { transitionDuration: {
50
50
  enter: 225,
51
51
  exit: 195
52
52
  } },
53
- children: f(1, r + 1).map((e) => /* @__PURE__ */ x(d, {
53
+ children: l(1, r + 1).map((e) => /* @__PURE__ */ x(c, {
54
54
  value: e,
55
55
  children: e
56
56
  }, `${e}`))
57
57
  })]
58
58
  });
59
- }, A = (e) => e === null || e === "null", j = o("div")(() => ({
59
+ }, A = (e) => e === null || e === "null", j = r("div")(() => ({
60
60
  display: "flex",
61
61
  width: "100%",
62
62
  position: "relative"
63
- })), M = o("div")(({ theme: e }) => ({
63
+ })), M = r("div")(({ theme: e }) => ({
64
64
  width: "100%",
65
65
  backgroundColor: `${e.palette.common.white}`
66
- })), N = o(y)(({ theme: e }) => ({
66
+ })), N = r(g)(({ theme: e }) => ({
67
67
  paddingTop: e.spacing(1),
68
68
  color: T[500]
69
- })), P = o(v)(({ theme: e }) => ({
69
+ })), P = r(h)(({ theme: e }) => ({
70
70
  color: T[500],
71
71
  paddingBottom: e.spacing(1),
72
72
  textTransform: "uppercase"
73
- })), F = o("div")(({ theme: e }) => ({ paddingLeft: e.spacing(3) })), I = o("div")(({ theme: e }) => ({
73
+ })), F = r("div")(({ theme: e }) => ({ paddingLeft: e.spacing(3) })), I = r("div")(({ theme: e }) => ({
74
74
  fontSize: e.typography.fontSize - 2,
75
75
  color: e.palette.error.main,
76
76
  paddingLeft: e.spacing(3),
77
77
  paddingTop: e.spacing(1)
78
- })), L = o("div")(() => ({
78
+ })), L = r("div")(() => ({
79
79
  position: "absolute",
80
80
  right: 0
81
- })), R = (e) => {
82
- let { points: t, content: n, sampleAnswer: i, mathMlOptions: a = {}, error: o, pluginOpts: s = {} } = e, c = `${t} ${t <= 1 ? "pt" : "pts"}`, l = A(i);
81
+ })), R = (t) => {
82
+ let { points: n, content: r, sampleAnswer: i, mathMlOptions: a = {}, error: o, pluginOpts: s = {} } = t, c = `${n} ${n <= 1 ? "pt" : "pts"}`, l = A(i);
83
83
  return /* @__PURE__ */ S("div", { children: [
84
84
  /* @__PURE__ */ x(P, {
85
85
  variant: "overline",
@@ -90,35 +90,35 @@ var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
90
90
  /* @__PURE__ */ x(M, { children: /* @__PURE__ */ x(C, {
91
91
  error: o,
92
92
  pluginProps: s,
93
- markup: n,
94
- onChange: e.onChange,
93
+ markup: r,
94
+ onChange: t.onChange,
95
95
  mathMlOptions: a
96
96
  }) }),
97
- /* @__PURE__ */ x(L, { children: /* @__PURE__ */ x(r, {
97
+ /* @__PURE__ */ x(L, { children: /* @__PURE__ */ x(e, {
98
98
  showSampleAnswer: l,
99
- onChange: e.onMenuChange
99
+ onChange: t.onMenuChange
100
100
  }) })
101
101
  ] }),
102
102
  o && /* @__PURE__ */ x(I, { children: o }),
103
103
  !l && /* @__PURE__ */ S(F, { children: [/* @__PURE__ */ x(N, {
104
- as: v,
104
+ as: h,
105
105
  variant: "overline",
106
106
  children: "Sample Response"
107
107
  }), /* @__PURE__ */ x(M, { children: /* @__PURE__ */ x(C, {
108
108
  markup: i,
109
109
  pluginProps: s,
110
- onChange: e.onSampleChange,
110
+ onChange: t.onSampleChange,
111
111
  mathMlOptions: a
112
112
  }) })] })
113
113
  ] });
114
- }, z = o("div")(({ theme: e }) => ({
114
+ }, z = r("div")(({ theme: e }) => ({
115
115
  backgroundColor: T[200],
116
116
  borderWidth: 1,
117
117
  borderStyle: "solid",
118
118
  borderColor: T[300],
119
119
  padding: e.spacing(2),
120
120
  margin: e.spacing(1)
121
- })), B = o(w)(({ theme: e }) => ({
121
+ })), B = r(w)(({ theme: e }) => ({
122
122
  width: "100%",
123
123
  paddingTop: e.spacing(2.5),
124
124
  marginBottom: e.spacing(2),
@@ -128,19 +128,19 @@ var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
128
128
  fontSize: e.typography.fontSize + 2,
129
129
  transform: "translate(0, 1.5px) scale(0.75)"
130
130
  }
131
- })), V = o("div")(() => ({ display: "none" })), H = o("div")(({ theme: e }) => ({
131
+ })), V = r("div")(() => ({ display: "none" })), H = r("div")(({ theme: e }) => ({
132
132
  paddingTop: e.spacing(1),
133
133
  paddingBottom: e.spacing(1)
134
- })), U = o(v)(({ theme: e }) => ({
134
+ })), U = r(h)(({ theme: e }) => ({
135
135
  paddingLeft: e.spacing(1),
136
136
  margin: e.spacing(1)
137
- })), W = class extends i.Component {
137
+ })), W = class extends t.Component {
138
138
  static propTypes = {
139
139
  value: O,
140
- config: a.object,
141
- pluginOpts: a.object,
142
- rubricless: a.bool,
143
- onChange: a.func
140
+ config: n.object,
141
+ pluginOpts: n.object,
142
+ rubricless: n.bool,
143
+ onChange: n.func
144
144
  };
145
145
  static defaultProps = {};
146
146
  dragEnd = (e) => {
@@ -163,7 +163,7 @@ var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
163
163
  let { value: t, onChange: n, rubricless: r } = this.props, i = t.points.length - 1;
164
164
  E("current", i, "new: ", e);
165
165
  let a, o;
166
- e > i && (a = m(e - i).map(() => "").concat(t.points), o = m(e - i).map(() => null).concat(t.sampleAnswers)), e < i && (E("less than"), a = p(t.points, e + 1), o = p(t.sampleAnswers, e + 1)), n(a && !r ? {
166
+ e > i && (a = d(e - i).map(() => "").concat(t.points), o = d(e - i).map(() => null).concat(t.sampleAnswers)), e < i && (E("less than"), a = u(t.points, e + 1), o = u(t.sampleAnswers, e + 1)), n(a && !r ? {
167
167
  ...t,
168
168
  points: a,
169
169
  sampleAnswers: o,
@@ -198,69 +198,69 @@ var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
198
198
  }
199
199
  };
200
200
  render() {
201
- let { value: r, mathMlOptions: i = {}, config: a = {}, rubricless: o = !1, pluginOpts: s = {} } = this.props, { excludeZeroEnabled: c = !0, maxPointsEnabled: l = !0, errors: u = {}, rubriclessInstructionEnabled: d = !1, maxPoints: f = 10 } = r || {}, { rubriclessInstruction: p = {}, maxMaxPoints: m = 10 } = a || {}, { pointsDescriptorsErrors: v } = u || {};
202
- r && Number.isFinite(r.maxPoints) && console.warn("maxPoints is deprecated - remove from model");
203
- let y = o ? f : r.excludeZero ? r.points.length : r.points.length - 1;
201
+ let { value: e, mathMlOptions: t = {}, config: n = {}, rubricless: r = !1, pluginOpts: i = {} } = this.props, { excludeZeroEnabled: a = !0, maxPointsEnabled: o = !0, errors: s = {}, rubriclessInstructionEnabled: c = !1, maxPoints: l = 10 } = e || {}, { rubriclessInstruction: u = {}, maxMaxPoints: d = 10 } = n || {}, { pointsDescriptorsErrors: h } = s || {};
202
+ e && Number.isFinite(e.maxPoints) && console.warn("maxPoints is deprecated - remove from model");
203
+ let g = r ? l : e.excludeZero ? e.points.length : e.points.length - 1;
204
204
  return /* @__PURE__ */ S("div", { children: [
205
205
  /* @__PURE__ */ x(U, {
206
206
  variant: "h5",
207
207
  children: "Rubric"
208
208
  }),
209
- /* @__PURE__ */ S(g, {
209
+ /* @__PURE__ */ S(p, {
210
210
  row: !0,
211
- children: [l && /* @__PURE__ */ x(k, {
212
- max: m < 100 ? m : 100,
213
- value: y,
211
+ children: [o && /* @__PURE__ */ x(k, {
212
+ max: d < 100 ? d : 100,
213
+ value: g,
214
214
  onChange: this.changeMaxPoints,
215
- pluginOpts: s
216
- }), c && /* @__PURE__ */ x(_, {
215
+ pluginOpts: i
216
+ }), a && /* @__PURE__ */ x(m, {
217
217
  label: "Exclude zeros",
218
- control: /* @__PURE__ */ x(h, {
219
- checked: r.excludeZero,
218
+ control: /* @__PURE__ */ x(f, {
219
+ checked: e.excludeZero,
220
220
  onChange: this.excludeZeros
221
221
  })
222
222
  })]
223
223
  }),
224
- d && o && /* @__PURE__ */ x(B, {
225
- label: p.label,
224
+ c && r && /* @__PURE__ */ x(B, {
225
+ label: u.label,
226
226
  children: /* @__PURE__ */ x(C, {
227
- markup: r.rubriclessInstruction || "",
227
+ markup: e.rubriclessInstruction || "",
228
228
  onChange: this.changeRubriclessInstruction,
229
- pluginProps: s,
229
+ pluginProps: i,
230
230
  nonEmpty: !1,
231
231
  disableUnderline: !0,
232
232
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
233
- mathMlOptions: i,
233
+ mathMlOptions: t,
234
234
  autoWidthToolbar: !0
235
235
  })
236
236
  }),
237
- /* @__PURE__ */ x("div", { children: o ? /* @__PURE__ */ x(V, {}) : /* @__PURE__ */ x(z, { children: /* @__PURE__ */ x(t, {
237
+ /* @__PURE__ */ x("div", { children: r ? /* @__PURE__ */ x(V, {}) : /* @__PURE__ */ x(z, { children: /* @__PURE__ */ x(_, {
238
238
  onDragEnd: this.dragEnd,
239
- children: /* @__PURE__ */ x(e, {
239
+ children: /* @__PURE__ */ x(y, {
240
240
  droppableId: "droppable",
241
- children: (e) => /* @__PURE__ */ S("div", {
242
- ...e.droppableProps,
243
- ref: e.innerRef,
244
- children: [r.points.map((e, t) => this.shouldRenderPoint(t, r) && /* @__PURE__ */ x(n, {
245
- index: t,
246
- draggableId: t.toString(),
247
- children: (n) => /* @__PURE__ */ x(H, {
248
- ref: n.innerRef,
249
- ...n.draggableProps,
250
- ...n.dragHandleProps,
241
+ children: (n) => /* @__PURE__ */ S("div", {
242
+ ...n.droppableProps,
243
+ ref: n.innerRef,
244
+ children: [e.points.map((n, r) => this.shouldRenderPoint(r, e) && /* @__PURE__ */ x(v, {
245
+ index: r,
246
+ draggableId: r.toString(),
247
+ children: (a) => /* @__PURE__ */ x(H, {
248
+ ref: a.innerRef,
249
+ ...a.draggableProps,
250
+ ...a.dragHandleProps,
251
251
  children: /* @__PURE__ */ x(R, {
252
- points: this.getPointForIndex(t, r),
253
- content: e,
254
- error: v && v[r.points.length - 1 - t],
255
- sampleAnswer: r.sampleAnswers && r.sampleAnswers[t],
256
- onChange: (e) => this.changeContent(t, e, "points"),
257
- onSampleChange: (e) => this.changeContent(t, e, "sampleAnswers"),
258
- onMenuChange: (e) => this.onPointMenuChange(t, e),
259
- mathMlOptions: i,
260
- pluginOpts: s
252
+ points: this.getPointForIndex(r, e),
253
+ content: n,
254
+ error: h && h[e.points.length - 1 - r],
255
+ sampleAnswer: e.sampleAnswers && e.sampleAnswers[r],
256
+ onChange: (e) => this.changeContent(r, e, "points"),
257
+ onSampleChange: (e) => this.changeContent(r, e, "sampleAnswers"),
258
+ onMenuChange: (e) => this.onPointMenuChange(r, e),
259
+ mathMlOptions: t,
260
+ pluginOpts: i
261
261
  })
262
262
  })
263
- }, `${e.points}-${t}`)), e.placeholder]
263
+ }, `${n.points}-${r}`)), n.placeholder]
264
264
  })
265
265
  })
266
266
  }) }) })
@@ -268,7 +268,7 @@ var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
268
268
  }
269
269
  }, G = (e) => {
270
270
  let { rubricless: t = !1, config: n = {}, pluginOpts: r = {} } = e || {}, i = Array.from(e.value.points || []).reverse(), a = Array.from(e.value.sampleAnswers || []).reverse();
271
- return i.length > a.length && (a = m(i.length - a.length).map(() => null).concat(a)), /* @__PURE__ */ x(W, {
271
+ return i.length > a.length && (a = d(i.length - a.length).map(() => null).concat(a)), /* @__PURE__ */ x(W, {
272
272
  value: {
273
273
  ...e.value,
274
274
  points: i,
@@ -288,11 +288,11 @@ var E = b("pie-lib:rubric:authoring"), D = (e, t, n) => {
288
288
  };
289
289
  G.propTypes = {
290
290
  value: O,
291
- config: a.object,
292
- pluginOpts: a.object,
293
- rubricless: a.bool,
294
- getIndex: a.func,
295
- onChange: a.func
291
+ config: n.object,
292
+ pluginOpts: n.object,
293
+ rubricless: n.bool,
294
+ getIndex: n.func,
295
+ onChange: n.func
296
296
  };
297
297
  //#endregion
298
- export { G as default };
298
+ export { R as PointConfig, W as RawAuthoring, O as RubricType, G as default };
@@ -70,4 +70,4 @@ var f = d(i, "InlineMenu") || d(h.InlineMenu, "InlineMenu"), p = r, m = p.defaul
70
70
  }
71
71
  };
72
72
  //#endregion
73
- export { _ as default };
73
+ export { g as IconMenu, _ as default };
package/package.json CHANGED
@@ -1,19 +1,24 @@
1
1
  {
2
2
  "name": "@pie-lib/rubric",
3
- "version": "2.0.4-next.31",
3
+ "version": "2.0.4-next.33",
4
4
  "description": "React implementation of @pie-lib/rubric synced from pie-lib",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/pie-framework/pie-elements-ng.git",
8
+ "directory": "packages/lib-react/rubric"
9
+ },
5
10
  "dependencies": {
6
11
  "@emotion/react": "^11.14.0",
7
- "@emotion/style": "^0.8.0",
12
+ "@emotion/styled": "^11.14.1",
8
13
  "@hello-pangea/dnd": "^18.0.1",
9
14
  "@mui/icons-material": "^7.3.4",
10
15
  "@mui/material": "^7.3.4",
11
- "@pie-lib/editable-html-tip-tap": "2.1.2-next.31",
16
+ "@pie-lib/editable-html-tip-tap": "2.1.2-next.33",
12
17
  "debug": "^4.1.1",
13
18
  "prop-types": "^15.7.2",
14
19
  "@pie-element/shared-lodash": "0.1.1-next.1",
15
- "@pie-lib/config-ui": "13.0.4-next.31",
16
- "@pie-lib/render-ui": "6.1.1-next.38"
20
+ "@pie-lib/config-ui": "13.0.4-next.33",
21
+ "@pie-lib/render-ui": "6.1.1-next.39"
17
22
  },
18
23
  "type": "module",
19
24
  "main": "./dist/index.js",
@@ -1,7 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
3
- if (typeof require < "u") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
- });
6
- //#endregion
7
- export { e as __commonJSMin, t as __require };
@@ -1,12 +0,0 @@
1
- //#region ../../../node_modules/.bun/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js
2
- function e() {
3
- return e = Object.assign ? Object.assign.bind() : function(e) {
4
- for (var t = 1; t < arguments.length; t++) {
5
- var n = arguments[t];
6
- for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
7
- }
8
- return e;
9
- }, e.apply(null, arguments);
10
- }
11
- //#endregion
12
- export { e as _extends };