@pie-element/likert 4.1.1 → 4.1.2-next.1

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 (87) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/choiceGenerator.d.ts +13 -0
  4. package/dist/author/choiceGenerator.js +255 -0
  5. package/dist/author/defaults.d.ts +102 -0
  6. package/dist/author/defaults.js +60 -0
  7. package/dist/author/index.d.ts +31 -0
  8. package/dist/author/index.js +73 -0
  9. package/dist/author/likertEntities.d.ts +25 -0
  10. package/dist/author/likertEntities.js +18 -0
  11. package/dist/author/main.d.ts +27 -0
  12. package/dist/author/main.js +298 -0
  13. package/dist/browser/Radio-CAjl01LA.js +9447 -0
  14. package/dist/browser/Radio-CAjl01LA.js.map +1 -0
  15. package/dist/browser/author/index.js +39374 -0
  16. package/dist/browser/author/index.js.map +1 -0
  17. package/dist/browser/controller/index.js +51 -0
  18. package/dist/browser/controller/index.js.map +1 -0
  19. package/dist/browser/delivery/index.js +219 -0
  20. package/dist/browser/delivery/index.js.map +1 -0
  21. package/dist/browser/likert.css +2 -0
  22. package/dist/controller/defaults.d.ts +19 -0
  23. package/dist/controller/defaults.js +13 -0
  24. package/dist/controller/index.d.ts +19 -0
  25. package/dist/controller/index.js +41 -0
  26. package/dist/delivery/choice-input.d.ts +27 -0
  27. package/dist/delivery/choice-input.js +59 -0
  28. package/dist/delivery/index.d.ts +19 -0
  29. package/dist/delivery/index.js +44 -0
  30. package/dist/delivery/likert.d.ts +26 -0
  31. package/dist/delivery/likert.js +70 -0
  32. package/dist/delivery/likertEntities.d.ts +12 -0
  33. package/dist/delivery/likertEntities.js +7 -0
  34. package/dist/delivery/main.d.ts +23 -0
  35. package/dist/delivery/main.js +37 -0
  36. package/dist/delivery/session-updater.d.ts +9 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.iife.d.ts +8 -0
  39. package/dist/index.iife.js +145 -0
  40. package/dist/index.js +2 -0
  41. package/dist/runtime-support.d.ts +12 -0
  42. package/dist/runtime-support.js +12 -0
  43. package/package.json +83 -21
  44. package/CHANGELOG.json +0 -1
  45. package/CHANGELOG.md +0 -1455
  46. package/LICENSE.md +0 -5
  47. package/configure/CHANGELOG.json +0 -1
  48. package/configure/CHANGELOG.md +0 -1373
  49. package/configure/lib/choiceGenerator.js +0 -219
  50. package/configure/lib/choiceGenerator.js.map +0 -1
  51. package/configure/lib/defaults.js +0 -100
  52. package/configure/lib/defaults.js.map +0 -1
  53. package/configure/lib/index.js +0 -106
  54. package/configure/lib/index.js.map +0 -1
  55. package/configure/lib/likertEntities.js +0 -24
  56. package/configure/lib/likertEntities.js.map +0 -1
  57. package/configure/lib/main.js +0 -388
  58. package/configure/lib/main.js.map +0 -1
  59. package/configure/package.json +0 -27
  60. package/controller/CHANGELOG.json +0 -1
  61. package/controller/CHANGELOG.md +0 -90
  62. package/controller/lib/defaults.js +0 -17
  63. package/controller/lib/defaults.js.map +0 -1
  64. package/controller/lib/index.js +0 -81
  65. package/controller/lib/index.js.map +0 -1
  66. package/controller/package.json +0 -17
  67. package/docs/config-schema.json +0 -2011
  68. package/docs/config-schema.json.md +0 -1487
  69. package/docs/demo/config.js +0 -8
  70. package/docs/demo/generate.js +0 -22
  71. package/docs/demo/index.html +0 -1
  72. package/docs/demo/session.js +0 -6
  73. package/docs/pie-schema.json +0 -966
  74. package/docs/pie-schema.json.md +0 -711
  75. package/lib/choice-input.js +0 -90
  76. package/lib/choice-input.js.map +0 -1
  77. package/lib/index.js +0 -64
  78. package/lib/index.js.map +0 -1
  79. package/lib/likert.js +0 -97
  80. package/lib/likert.js.map +0 -1
  81. package/lib/likertEntities.js +0 -11
  82. package/lib/likertEntities.js.map +0 -1
  83. package/lib/main.js +0 -42
  84. package/lib/main.js.map +0 -1
  85. package/lib/session-updater.js +0 -15
  86. package/lib/session-updater.js.map +0 -1
  87. package/readme.md +0 -55
@@ -0,0 +1,298 @@
1
+ import { LIKERT_ORIENTATION as e, LIKERT_SCALE as t, LIKERT_TYPE as n } from "./likertEntities.js";
2
+ import r from "./choiceGenerator.js";
3
+ import i from "react";
4
+ import a from "prop-types";
5
+ import { color as o } from "@pie-lib/render-ui";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import l from "@mui/material/FormControlLabel";
8
+ import { styled as u } from "@mui/material/styles";
9
+ import d from "@mui/material/Radio";
10
+ import f from "@pie-lib/editable-html-tip-tap";
11
+ import p from "@mui/material/RadioGroup";
12
+ import { InputContainer as m, NumberTextField as h, layout as g, settings as _ } from "@pie-lib/config-ui";
13
+ import { merge as v } from "@pie-element/shared-lodash";
14
+ //#region src/author/main.tsx
15
+ var { Panel: y, toggle: b, radio: x } = _, S = u(m)(({ theme: e }) => ({
16
+ width: "100%",
17
+ paddingTop: e.spacing(2),
18
+ marginBottom: e.spacing(2)
19
+ })), C = u("div")({
20
+ display: "flex",
21
+ flexDirection: "column"
22
+ }), w = u("p")(({ theme: e }) => ({
23
+ color: e.palette.grey[400],
24
+ fontSize: e.typography.fontSize - 2
25
+ })), T = u("div")(({ theme: e }) => ({
26
+ display: "flex",
27
+ width: "100%",
28
+ alignItems: "flex-start",
29
+ marginBottom: e.spacing(2)
30
+ })), E = u("div")(({ theme: e }) => ({
31
+ display: "flex",
32
+ width: "100%",
33
+ justifyContent: "space-around",
34
+ marginBottom: e.spacing(2.5)
35
+ })), D = u(m)({
36
+ width: "calc(100% - 200px)",
37
+ marginRight: 0
38
+ }), O = u("p")(({ theme: e }) => ({
39
+ color: e.palette.error.main,
40
+ fontSize: e.typography.fontSize - 2
41
+ })), k = u(h)({ width: "100%" }), A = u("div")({
42
+ display: "flex",
43
+ flexDirection: "row"
44
+ }), j = u("div")(({ theme: e }) => ({
45
+ paddingLeft: e.spacing(2.5),
46
+ width: "150px"
47
+ })), M = u(f)(({ theme: e }) => ({ paddingTop: e.spacing(2) })), N = u("span")(({ theme: e }) => ({
48
+ width: "30px",
49
+ paddingTop: e.spacing(4)
50
+ })), P = u("div")(({ theme: e }) => ({
51
+ fontSize: e.typography.fontSize - 2,
52
+ color: e.palette.error.main,
53
+ paddingTop: e.spacing(1)
54
+ })), F = u(d)({ color: `${o.tertiary()} !important` }), I = (t) => {
55
+ let { model: n, onChangeModel: r } = t;
56
+ return /* @__PURE__ */ c(C, { children: [/* @__PURE__ */ s(w, { children: "Likert Orientation" }), /* @__PURE__ */ c(p, {
57
+ "aria-label": "likertOrientation",
58
+ name: "likertOrientation",
59
+ value: n.likertOrientation,
60
+ onChange: (e) => {
61
+ let t = e.target.value;
62
+ r({
63
+ ...n,
64
+ likertOrientation: t
65
+ });
66
+ },
67
+ children: [/* @__PURE__ */ s(l, {
68
+ value: e.horizontal,
69
+ control: /* @__PURE__ */ s(F, {}),
70
+ label: "Horizontal"
71
+ }), /* @__PURE__ */ s(l, {
72
+ value: e.vertical,
73
+ control: /* @__PURE__ */ s(F, {}),
74
+ label: "Vertical"
75
+ })]
76
+ })] });
77
+ }, L = (e) => {
78
+ let { model: n, onChangeModel: i } = e;
79
+ return /* @__PURE__ */ c(C, { children: [/* @__PURE__ */ s(w, { children: "Likert Scale" }), /* @__PURE__ */ c(p, {
80
+ "aria-label": "likertScale",
81
+ name: "likertScale",
82
+ value: n.likertScale,
83
+ onChange: (e) => {
84
+ let t = e.target.value;
85
+ i({
86
+ ...n,
87
+ likertScale: t,
88
+ choices: r(t, n.likertType)
89
+ });
90
+ },
91
+ children: [
92
+ /* @__PURE__ */ s(l, {
93
+ value: t.likert3,
94
+ control: /* @__PURE__ */ s(F, {}),
95
+ label: "Likert 3"
96
+ }),
97
+ /* @__PURE__ */ s(l, {
98
+ value: t.likert5,
99
+ control: /* @__PURE__ */ s(F, {}),
100
+ label: "Likert 5"
101
+ }),
102
+ /* @__PURE__ */ s(l, {
103
+ value: t.likert7,
104
+ control: /* @__PURE__ */ s(F, {}),
105
+ label: "Likert 7"
106
+ })
107
+ ]
108
+ })] });
109
+ }, R = (e) => {
110
+ let { model: t, onChangeModel: i } = e, a = (e) => {
111
+ let n = e.target.value;
112
+ i({
113
+ ...t,
114
+ likertType: n,
115
+ choices: r(t.likertScale, n)
116
+ });
117
+ };
118
+ return /* @__PURE__ */ c(C, { children: [/* @__PURE__ */ s(w, { children: "Label Type" }), /* @__PURE__ */ c(A, { children: [/* @__PURE__ */ c(p, {
119
+ "aria-label": "likertLabelType",
120
+ name: "likertLabelType",
121
+ value: t.likertType,
122
+ onChange: a,
123
+ children: [
124
+ /* @__PURE__ */ s(l, {
125
+ value: n.agreement,
126
+ control: /* @__PURE__ */ s(F, {}),
127
+ label: "Agreement"
128
+ }),
129
+ /* @__PURE__ */ s(l, {
130
+ value: n.frequency,
131
+ control: /* @__PURE__ */ s(F, {}),
132
+ label: "Frequency"
133
+ }),
134
+ /* @__PURE__ */ s(l, {
135
+ value: n.yesNo,
136
+ control: /* @__PURE__ */ s(F, {}),
137
+ label: "Yes/No"
138
+ })
139
+ ]
140
+ }), /* @__PURE__ */ c(p, {
141
+ "aria-label": "likertLabelType",
142
+ name: "likertLabelType",
143
+ value: t.likertType,
144
+ onChange: a,
145
+ children: [
146
+ /* @__PURE__ */ s(l, {
147
+ value: n.importance,
148
+ control: /* @__PURE__ */ s(F, {}),
149
+ label: "Importance"
150
+ }),
151
+ /* @__PURE__ */ s(l, {
152
+ value: n.likelihood,
153
+ control: /* @__PURE__ */ s(F, {}),
154
+ label: "Likelihood"
155
+ }),
156
+ /* @__PURE__ */ s(l, {
157
+ value: n.like,
158
+ control: /* @__PURE__ */ s(F, {}),
159
+ label: "Like"
160
+ })
161
+ ]
162
+ })] })] });
163
+ }, z = (e) => e.choices.reduce((e, t) => {
164
+ let n = { ...e }, r = parseInt(t.value);
165
+ return n[r] || (n[r] = 0), {
166
+ ...n,
167
+ [r]: n[r] + 1
168
+ };
169
+ }, {}), B = (e) => {
170
+ let { configuration: t, imageSupport: n, model: r, onChangeModel: i, onChoiceChanged: a, onConfigurationChanged: o, onPromptChanged: l, onTeacherInstructionsChanged: u, uploadSoundSupport: d } = e, { contentDimensions: p = {}, prompt: m = {}, scoringType: h = {}, settingsPanelDisabled: _, spellCheck: v = {}, teacherInstructions: C = {}, baseInputConfiguration: w = {}, likertChoice: A = {} } = t || {}, { errors: F = {}, extraCSSRules: B, spellCheckEnabled: V, teacherInstructionsEnabled: H } = r || {}, { prompt: U, teacherInstructions: W } = F, G = z(r), K = {
171
+ teacherInstructionsEnabled: C.settings && b(C.label),
172
+ spellCheckEnabled: v.settings && b(v.label),
173
+ scoringType: h.settings && x(h.label, ["auto", "rubric"])
174
+ }, q = (e = {}) => Object.assign({ ...w }, e || {});
175
+ return /* @__PURE__ */ c(g.ConfigLayout, {
176
+ extraCSSRules: B,
177
+ dimensions: p,
178
+ hideSettings: _,
179
+ settings: /* @__PURE__ */ s(y, {
180
+ model: r,
181
+ onChangeModel: i,
182
+ configuration: t,
183
+ onChangeConfiguration: o,
184
+ groups: { Properties: K }
185
+ }),
186
+ children: [
187
+ H && /* @__PURE__ */ c(S, {
188
+ label: C.label,
189
+ children: [/* @__PURE__ */ s(f, {
190
+ markup: r.teacherInstructions || "",
191
+ onChange: u,
192
+ imageSupport: n,
193
+ nonEmpty: !1,
194
+ error: W,
195
+ spellCheck: V,
196
+ uploadSoundSupport: d,
197
+ pluginProps: q(C?.inputConfiguration)
198
+ }), W && /* @__PURE__ */ s(P, { children: W })]
199
+ }),
200
+ /* @__PURE__ */ c(S, {
201
+ label: m.label,
202
+ children: [/* @__PURE__ */ s(f, {
203
+ markup: r.prompt,
204
+ onChange: l,
205
+ imageSupport: n,
206
+ nonEmpty: !1,
207
+ error: U,
208
+ spellCheck: V,
209
+ disableUnderline: !0,
210
+ uploadSoundSupport: d,
211
+ pluginProps: q(m?.inputConfiguration)
212
+ }), U && /* @__PURE__ */ s(P, { children: U })]
213
+ }),
214
+ /* @__PURE__ */ c(E, { children: [
215
+ /* @__PURE__ */ s(L, {
216
+ model: r,
217
+ onChangeModel: i
218
+ }),
219
+ /* @__PURE__ */ s(R, {
220
+ model: r,
221
+ onChangeModel: i
222
+ }),
223
+ /* @__PURE__ */ s(I, {
224
+ model: r,
225
+ onChangeModel: i
226
+ })
227
+ ] }),
228
+ r.choices.map((e, t) => /* @__PURE__ */ c(T, { children: [
229
+ /* @__PURE__ */ c(N, { children: [t + 1, "."] }),
230
+ /* @__PURE__ */ s(D, {
231
+ label: "Likert Label",
232
+ children: /* @__PURE__ */ s(M, {
233
+ markup: e.label || "",
234
+ onChange: (n) => a(t, {
235
+ ...e,
236
+ label: n
237
+ }),
238
+ imageSupport: n,
239
+ spellCheck: V,
240
+ uploadSoundSupport: d,
241
+ pluginProps: q(A?.inputConfiguration)
242
+ })
243
+ }, `likert-label-${t}`),
244
+ /* @__PURE__ */ c(j, { children: [/* @__PURE__ */ s(k, {
245
+ label: "Likert Value",
246
+ value: e.value,
247
+ max: 100,
248
+ min: -100,
249
+ onChange: (n, r) => {
250
+ a(t, {
251
+ ...e,
252
+ value: r
253
+ });
254
+ },
255
+ imageSupport: n
256
+ }), G[e.value] && G[e.value] > 1 && /* @__PURE__ */ s(O, { children: "Value should be unique" })] })
257
+ ] }, `choice-${t}`))
258
+ ]
259
+ });
260
+ }, V = class extends i.Component {
261
+ static propTypes = {
262
+ model: a.object.isRequired,
263
+ disableSidePanel: a.bool,
264
+ onModelChanged: a.func.isRequired,
265
+ onConfigurationChanged: a.func.isRequired,
266
+ imageSupport: a.shape({
267
+ add: a.func.isRequired,
268
+ delete: a.func.isRequired
269
+ })
270
+ };
271
+ onChoiceChanged = (e, t) => {
272
+ let { model: n, onModelChanged: r } = this.props;
273
+ n.choices = n.choices.map((e) => v({}, e)), n.choices.splice(e, 1, t), r(n);
274
+ };
275
+ onPromptChanged = (e) => {
276
+ this.props.onModelChanged({
277
+ ...this.props.model,
278
+ prompt: e
279
+ });
280
+ };
281
+ onTeacherInstructionsChanged = (e) => {
282
+ this.props.onModelChanged({
283
+ ...this.props.model,
284
+ teacherInstructions: e
285
+ });
286
+ };
287
+ render() {
288
+ return /* @__PURE__ */ s(B, {
289
+ ...this.props,
290
+ onChangeModel: this.props.onModelChanged,
291
+ onChoiceChanged: this.onChoiceChanged,
292
+ onPromptChanged: this.onPromptChanged,
293
+ onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
294
+ });
295
+ }
296
+ };
297
+ //#endregion
298
+ export { V as default };