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

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/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +1462 -0
  3. package/LICENSE.md +5 -0
  4. package/configure/CHANGELOG.json +1 -0
  5. package/configure/CHANGELOG.md +1379 -0
  6. package/configure/lib/choiceGenerator.js +219 -0
  7. package/configure/lib/choiceGenerator.js.map +1 -0
  8. package/configure/lib/defaults.js +100 -0
  9. package/configure/lib/defaults.js.map +1 -0
  10. package/configure/lib/index.js +106 -0
  11. package/configure/lib/index.js.map +1 -0
  12. package/configure/lib/likertEntities.js +24 -0
  13. package/configure/lib/likertEntities.js.map +1 -0
  14. package/configure/lib/main.js +388 -0
  15. package/configure/lib/main.js.map +1 -0
  16. package/configure/package.json +27 -0
  17. package/controller/CHANGELOG.json +1 -0
  18. package/controller/CHANGELOG.md +90 -0
  19. package/controller/lib/defaults.js +17 -0
  20. package/controller/lib/defaults.js.map +1 -0
  21. package/controller/lib/index.js +81 -0
  22. package/controller/lib/index.js.map +1 -0
  23. package/controller/package.json +17 -0
  24. package/docs/config-schema.json +2011 -0
  25. package/docs/config-schema.json.md +1487 -0
  26. package/docs/demo/config.js +8 -0
  27. package/docs/demo/generate.js +22 -0
  28. package/docs/demo/index.html +1 -0
  29. package/docs/demo/session.js +6 -0
  30. package/docs/pie-schema.json +966 -0
  31. package/docs/pie-schema.json.md +711 -0
  32. package/lib/choice-input.js +90 -0
  33. package/lib/choice-input.js.map +1 -0
  34. package/lib/index.js +64 -0
  35. package/lib/index.js.map +1 -0
  36. package/lib/likert.js +97 -0
  37. package/lib/likert.js.map +1 -0
  38. package/lib/likertEntities.js +11 -0
  39. package/lib/likertEntities.js.map +1 -0
  40. package/lib/main.js +42 -0
  41. package/lib/main.js.map +1 -0
  42. package/lib/session-updater.js +15 -0
  43. package/lib/session-updater.js.map +1 -0
  44. package/package.json +21 -84
  45. package/readme.md +55 -0
  46. package/configure.js +0 -2
  47. package/controller.js +0 -1
  48. package/dist/author/choiceGenerator.d.ts +0 -13
  49. package/dist/author/choiceGenerator.js +0 -255
  50. package/dist/author/defaults.d.ts +0 -102
  51. package/dist/author/defaults.js +0 -60
  52. package/dist/author/index.d.ts +0 -31
  53. package/dist/author/index.js +0 -73
  54. package/dist/author/likertEntities.d.ts +0 -25
  55. package/dist/author/likertEntities.js +0 -18
  56. package/dist/author/main.d.ts +0 -27
  57. package/dist/author/main.js +0 -298
  58. package/dist/browser/Radio-CAjl01LA.js +0 -9447
  59. package/dist/browser/Radio-CAjl01LA.js.map +0 -1
  60. package/dist/browser/author/index.js +0 -39374
  61. package/dist/browser/author/index.js.map +0 -1
  62. package/dist/browser/controller/index.js +0 -51
  63. package/dist/browser/controller/index.js.map +0 -1
  64. package/dist/browser/delivery/index.js +0 -219
  65. package/dist/browser/delivery/index.js.map +0 -1
  66. package/dist/browser/likert.css +0 -2
  67. package/dist/controller/defaults.d.ts +0 -19
  68. package/dist/controller/defaults.js +0 -13
  69. package/dist/controller/index.d.ts +0 -19
  70. package/dist/controller/index.js +0 -41
  71. package/dist/delivery/choice-input.d.ts +0 -27
  72. package/dist/delivery/choice-input.js +0 -59
  73. package/dist/delivery/index.d.ts +0 -19
  74. package/dist/delivery/index.js +0 -44
  75. package/dist/delivery/likert.d.ts +0 -26
  76. package/dist/delivery/likert.js +0 -70
  77. package/dist/delivery/likertEntities.d.ts +0 -12
  78. package/dist/delivery/likertEntities.js +0 -7
  79. package/dist/delivery/main.d.ts +0 -23
  80. package/dist/delivery/main.js +0 -37
  81. package/dist/delivery/session-updater.d.ts +0 -9
  82. package/dist/index.d.ts +0 -1
  83. package/dist/index.iife.d.ts +0 -8
  84. package/dist/index.iife.js +0 -145
  85. package/dist/index.js +0 -2
  86. package/dist/runtime-support.d.ts +0 -12
  87. package/dist/runtime-support.js +0 -12
@@ -1,298 +0,0 @@
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 };