@instructure/platform-rubrics 3.0.1 → 3.2.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.
Files changed (47) hide show
  1. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubric.d.ts +1 -0
  2. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubric.d.ts.map +1 -1
  3. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubricState.d.ts +1 -0
  4. package/dist/_internal/RubricAssignment/hooks/useAssignmentRubricState.d.ts.map +1 -1
  5. package/dist/_internal/RubricForm/components/RubricGeneratorNutritionFacts.d.ts.map +1 -0
  6. package/dist/_internal/ViewRubrics/useRubricsQuery.d.ts.map +1 -1
  7. package/dist/_internal/ViewRubrics/useViewRubrics.d.ts.map +1 -1
  8. package/dist/_internal/constants/i18n.d.ts +18 -0
  9. package/dist/_internal/constants/i18n.d.ts.map +1 -1
  10. package/dist/_internal/utils/i18n.d.ts +18 -0
  11. package/dist/_internal/utils/i18n.d.ts.map +1 -1
  12. package/dist/canvas.js +3679 -9389
  13. package/dist/chunks/{errorPage-CYyehhNJ.js → errorPage-C2-lUC8H.js} +209 -151
  14. package/dist/chunks/useAssignmentRubricState-DpcMVo45.js +10497 -0
  15. package/dist/foundation/RubricAssignmentBuilder/RubricAssignmentBuilder.d.ts +28 -0
  16. package/dist/foundation/RubricAssignmentBuilder/RubricAssignmentBuilder.d.ts.map +1 -0
  17. package/dist/foundation/RubricBuilder/RubricBuilder.d.ts.map +1 -1
  18. package/dist/foundation/RubricBuilder/components/CriteriaSection.d.ts +3 -1
  19. package/dist/foundation/RubricBuilder/components/CriteriaSection.d.ts.map +1 -1
  20. package/dist/foundation/RubricBuilder/components/RubricBuilderFooter.d.ts +4 -1
  21. package/dist/foundation/RubricBuilder/components/RubricBuilderFooter.d.ts.map +1 -1
  22. package/dist/foundation/RubricBuilder/components/generator/GenerateCriteriaForm.d.ts +14 -0
  23. package/dist/foundation/RubricBuilder/components/generator/GenerateCriteriaForm.d.ts.map +1 -0
  24. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaFeedback.d.ts +8 -0
  25. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaFeedback.d.ts.map +1 -0
  26. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaSummary.d.ts +11 -0
  27. package/dist/foundation/RubricBuilder/components/generator/GeneratedCriteriaSummary.d.ts.map +1 -0
  28. package/dist/foundation/RubricBuilder/components/generator/RegenerateCriteriaModal.d.ts +7 -0
  29. package/dist/foundation/RubricBuilder/components/generator/RegenerateCriteriaModal.d.ts.map +1 -0
  30. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorPanel.d.ts +9 -0
  31. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorPanel.d.ts.map +1 -0
  32. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorStatus.d.ts +9 -0
  33. package/dist/foundation/RubricBuilder/components/generator/RubricGeneratorStatus.d.ts.map +1 -0
  34. package/dist/foundation/RubricBuilder/components/preview/RubricPreviewPanel.d.ts +10 -0
  35. package/dist/foundation/RubricBuilder/components/preview/RubricPreviewPanel.d.ts.map +1 -0
  36. package/dist/foundation/RubricBuilder/useCriteriaGenerator.d.ts +44 -0
  37. package/dist/foundation/RubricBuilder/useCriteriaGenerator.d.ts.map +1 -0
  38. package/dist/foundation/index.d.ts +2 -0
  39. package/dist/foundation/index.d.ts.map +1 -1
  40. package/dist/foundation.js +1304 -571
  41. package/dist/index.js +8 -9
  42. package/locales/en.json +18 -0
  43. package/package.json +2 -2
  44. package/dist/canvas/RubricForm/components/AIGeneratedCriteria/RubricGeneratorNutritionFacts.d.ts.map +0 -1
  45. package/dist/chunks/ErrorShip-COgM3wMV.js +0 -4726
  46. package/dist/chunks/useLocalStorage-BoUaI48x.js +0 -41
  47. /package/dist/{canvas/RubricForm/components/AIGeneratedCriteria → _internal/RubricForm/components}/RubricGeneratorNutritionFacts.d.ts +0 -0
@@ -1,36 +1,44 @@
1
- import { g as Ue, R as be, u as D, f as _e, h as Ge, r as $e, i as le, b as Fe } from "./chunks/errorPage-CYyehhNJ.js";
2
- import { D as ki, a as Ti, d as xi } from "./chunks/errorPage-CYyehhNJ.js";
1
+ import { g as Br, R as we, h as B, i as ue, j as We, k as je, r as Ir, l as xe, c as Lr } from "./chunks/errorPage-C2-lUC8H.js";
2
+ import { D as zt, a as $t, d as Ut } from "./chunks/errorPage-C2-lUC8H.js";
3
3
  import "@instructure/platform-provider";
4
- import { useState as w, useEffect as $, useRef as ae, useCallback as qe } from "react";
5
- import { jsx as e, jsxs as m, Fragment as ze } from "react/jsx-runtime";
6
- import { Heading as U } from "@instructure/ui-heading";
7
- import { View as p } from "@instructure/ui-view";
8
- import { Button as A, CloseButton as We, IconButton as Y } from "@instructure/ui-buttons";
9
- import { Flex as v } from "@instructure/ui-flex";
10
- import { SimpleSelect as te } from "@instructure/ui-simple-select";
11
- import { Spinner as je } from "@instructure/ui-spinner";
12
- import { Text as k } from "@instructure/ui-text";
13
- import { useQuery as Ke } from "@tanstack/react-query";
14
- import { u as ge, g as Qe, p as Ve, a as he, b as de, C as pe, c as ce, i as Xe, d as fe, e as J, s as Ce, K as ve, P as Re, r as Ye, D as Be, S as Se, v as ye, f as Ze, h as Je, j as er, k as rr, l as ir, m as tr, n as nr, w as ue, o as ar, q as or, t as sr, x as lr, y as dr, z as cr, A as ur, B as mr, E as br } from "./chunks/ErrorShip-COgM3wMV.js";
15
- import gr from "graphql-tag";
16
- import { LoadingIndicator as hr } from "@instructure/platform-loading-indicator";
17
- import { Alert as pr } from "@instructure/ui-alerts";
18
- import { IconDragHandleLine as De, IconTrashLine as Ie, IconAddLine as Le, IconArrowOpenDownLine as fr, IconArrowOpenEndLine as Cr, IconCommentLine as vr, IconDuplicateLine as Rr } from "@instructure/ui-icons";
19
- import { Checkbox as ne } from "@instructure/ui-checkbox/v11_7";
20
- import { Flex as Br } from "@instructure/ui-flex/v11_7";
21
- import { Modal as Q } from "@instructure/ui-modal";
22
- import { ScreenReaderContent as Sr } from "@instructure/ui-a11y-content";
23
- import { Checkbox as yr } from "@instructure/ui-checkbox";
24
- import { Pill as we } from "@instructure/ui-pill";
25
- import { TextArea as Dr } from "@instructure/ui-text-area";
26
- import { TextInput as F } from "@instructure/ui-text-input";
27
- import { NumberInput as Ir } from "@instructure/ui-number-input";
28
- import { CloseButton as Lr, Button as me } from "@instructure/ui-buttons/v11_7";
29
- import { Heading as wr } from "@instructure/ui-heading/v11_7";
30
- import { Modal as V } from "@instructure/ui-modal/v11_7";
31
- import { Text as kr } from "@instructure/ui-text/v11_7";
32
- import { RadioInputGroup as Tr, RadioInput as xr } from "@instructure/ui-radio-input";
33
- const yi = () => /* @__PURE__ */ e(p, { as: "div", padding: "small", children: /* @__PURE__ */ e(U, { level: "h2", children: Ue("foundation") }) }), Pr = gr`
4
+ import { useState as y, useEffect as N, useRef as F, useMemo as Ae, useCallback as Ke } from "react";
5
+ import { jsx as e, jsxs as b, Fragment as Se } from "react/jsx-runtime";
6
+ import { Heading as V } from "@instructure/ui-heading";
7
+ import { View as P } from "@instructure/ui-view";
8
+ import { Button as H, CloseButton as yr, IconButton as oe } from "@instructure/ui-buttons";
9
+ import { Flex as k } from "@instructure/ui-flex";
10
+ import { SimpleSelect as Ce } from "@instructure/ui-simple-select";
11
+ import { Spinner as kr } from "@instructure/ui-spinner";
12
+ import { Text as G } from "@instructure/ui-text";
13
+ import { useQuery as Tr } from "@tanstack/react-query";
14
+ import { u as be, g as Pr, p as Dr, a as Xe, b as Oe, C as Ye, c as Ge, i as Er, d as Qe, e as de, s as Je, K as Ze, P as er, r as Mr, D as rr, S as ir, v as tr, f as xr, h as Ar, j as Or, k as Gr, l as _r, m as Nr, n as Fr, w as _e, o as Hr, q as zr, t as $r, x as Ur, T as Vr, M as qr, y as Wr, z as Ne, A as ve, G as jr, B as Kr, E as Fe, F as Xr, H as He, R as Yr, I as Qr, J as Jr, L as Zr, N as ei, O as ri, Q as ii, U as ti, V as ni, W as ai, X as oi, Y as li } from "./chunks/useAssignmentRubricState-DpcMVo45.js";
15
+ import si from "graphql-tag";
16
+ import { LoadingIndicator as nr } from "@instructure/platform-loading-indicator";
17
+ import { Alert as di } from "@instructure/ui-alerts";
18
+ import { IconDragHandleLine as ar, IconTrashLine as or, IconAddLine as lr, IconArrowOpenDownLine as ci, IconArrowOpenEndLine as ui, IconCommentLine as bi, IconDuplicateLine as mi, IconAiSolid as me, IconLikeSolid as ze, IconLikeLine as $e, IconAiColoredSolid as sr } from "@instructure/ui-icons";
19
+ import { Checkbox as le } from "@instructure/ui-checkbox/v11_7";
20
+ import { Flex as T } from "@instructure/ui-flex/v11_7";
21
+ import { Modal as ne } from "@instructure/ui-modal";
22
+ import { ScreenReaderContent as dr } from "@instructure/ui-a11y-content";
23
+ import { Checkbox as gi } from "@instructure/ui-checkbox";
24
+ import { Pill as cr } from "@instructure/ui-pill";
25
+ import { TextArea as hi } from "@instructure/ui-text-area";
26
+ import { TextInput as X } from "@instructure/ui-text-input";
27
+ import { NumberInput as pi } from "@instructure/ui-number-input";
28
+ import { CloseButton as Be, Button as A, IconButton as Ue } from "@instructure/ui-buttons/v11_7";
29
+ import { Heading as q } from "@instructure/ui-heading/v11_7";
30
+ import { Modal as M } from "@instructure/ui-modal/v11_7";
31
+ import { Text as Y } from "@instructure/ui-text/v11_7";
32
+ import { SimpleSelect as $ } from "@instructure/ui-simple-select/v11_7";
33
+ import { View as Re } from "@instructure/ui-view/v11_7";
34
+ import { RadioInputGroup as fi, RadioInput as Ci } from "@instructure/ui-radio-input";
35
+ import { ProgressBar as vi } from "@instructure/ui-progress/v11_7";
36
+ import { Spinner as Ri } from "@instructure/ui-spinner/v11_7";
37
+ import { TextArea as ce } from "@instructure/ui-text-area/v11_7";
38
+ import { TextInput as wi } from "@instructure/ui-text-input/v11_7";
39
+ import { Tooltip as Si } from "@instructure/ui-tooltip/v11_7";
40
+ import { Alert as Bi } from "@instructure/ui-alerts/v11_7";
41
+ const Gt = () => /* @__PURE__ */ e(P, { as: "div", padding: "small", children: /* @__PURE__ */ e(V, { level: "h2", children: Br("foundation") }) }), Ii = si`
34
42
  query CourseRubricsList($courseId: ID!, $first: Int) {
35
43
  course(id: $courseId) {
36
44
  rubricsConnection(first: $first) {
@@ -48,493 +56,495 @@ const yi = () => /* @__PURE__ */ e(p, { as: "div", padding: "small", children: /
48
56
  }
49
57
  }
50
58
  `;
51
- function Er(r) {
52
- const { executeQuery: o } = ge();
53
- return Ke({
59
+ function Li(r) {
60
+ const { executeQuery: a } = be();
61
+ return Tr({
54
62
  queryKey: ["courseRubrics", r],
55
63
  queryFn: async () => {
56
- var a;
57
- const { course: s } = await o(Pr, {
64
+ var n;
65
+ const { course: s } = await a(Ii, {
58
66
  courseId: r,
59
67
  first: 50
60
68
  }), i = s == null ? void 0 : s.rubricsConnection;
61
69
  return {
62
70
  rubrics: ((i == null ? void 0 : i.nodes) ?? []).filter(
63
- (d) => d != null
71
+ (l) => l != null
64
72
  ),
65
- hasMore: ((a = i == null ? void 0 : i.pageInfo) == null ? void 0 : a.hasNextPage) ?? !1
73
+ hasMore: ((n = i == null ? void 0 : i.pageInfo) == null ? void 0 : n.hasNextPage) ?? !1
66
74
  };
67
75
  },
68
76
  enabled: !!r
69
77
  });
70
78
  }
71
- const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children: /* @__PURE__ */ e(Or, { ...r }) }), Or = ({
79
+ const _t = (r) => /* @__PURE__ */ e(we, { translations: r.translations, children: /* @__PURE__ */ e(yi, { ...r }) }), yi = ({
72
80
  courseId: r,
73
- value: o,
81
+ value: a,
74
82
  onChange: s
75
83
  }) => {
76
- const { translations: i } = D(), { data: a, isLoading: d, isError: t, refetch: g } = Er(r), l = a == null ? void 0 : a.rubrics;
77
- return d ? /* @__PURE__ */ m(p, { as: "div", role: "status", "aria-live": "polite", margin: "0 0 medium", children: [
78
- /* @__PURE__ */ e(je, { renderTitle: i.rubricSelectorLoading, size: "x-small" }),
79
- /* @__PURE__ */ e(p, { as: "span", padding: "0 0 0 x-small", children: /* @__PURE__ */ e(k, { size: "small", children: i.rubricSelectorLoading }) })
80
- ] }) : t ? /* @__PURE__ */ e(p, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ m(v, { gap: "small", alignItems: "center", wrap: "wrap", children: [
81
- /* @__PURE__ */ e(v.Item, { children: /* @__PURE__ */ m(k, { size: "small", color: "danger", children: [
84
+ const { translations: i } = B(), { data: n, isLoading: l, isError: o, refetch: m } = Li(r), t = n == null ? void 0 : n.rubrics;
85
+ return l ? /* @__PURE__ */ b(P, { as: "div", role: "status", "aria-live": "polite", margin: "0 0 medium", children: [
86
+ /* @__PURE__ */ e(kr, { renderTitle: i.rubricSelectorLoading, size: "x-small" }),
87
+ /* @__PURE__ */ e(P, { as: "span", padding: "0 0 0 x-small", children: /* @__PURE__ */ e(G, { size: "small", children: i.rubricSelectorLoading }) })
88
+ ] }) : o ? /* @__PURE__ */ e(P, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ b(k, { gap: "small", alignItems: "center", wrap: "wrap", children: [
89
+ /* @__PURE__ */ e(k.Item, { children: /* @__PURE__ */ b(G, { size: "small", color: "danger", children: [
82
90
  i.rubricSelectorErrorTitle,
83
91
  ". ",
84
92
  i.rubricSelectorErrorBody
85
93
  ] }) }),
86
- /* @__PURE__ */ e(v.Item, { children: /* @__PURE__ */ e(A, { size: "small", onClick: () => g(), children: i.rubricSelectorRetry }) })
87
- ] }) }) : !l || l.length === 0 ? /* @__PURE__ */ e(p, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ e(k, { size: "small", children: i.rubricSelectorEmpty }) }) : /* @__PURE__ */ m(p, { as: "div", margin: "0 0 medium", maxWidth: "360px", children: [
88
- /* @__PURE__ */ m(
89
- te,
94
+ /* @__PURE__ */ e(k.Item, { children: /* @__PURE__ */ e(H, { size: "small", onClick: () => m(), children: i.rubricSelectorRetry }) })
95
+ ] }) }) : !t || t.length === 0 ? /* @__PURE__ */ e(P, { as: "div", margin: "0 0 medium", children: /* @__PURE__ */ e(G, { size: "small", children: i.rubricSelectorEmpty }) }) : /* @__PURE__ */ b(P, { as: "div", margin: "0 0 medium", maxWidth: "360px", children: [
96
+ /* @__PURE__ */ b(
97
+ Ce,
90
98
  {
91
99
  renderLabel: i.rubricSelectorLabel,
92
100
  assistiveText: i.rubricSelectorAssistiveText,
93
- value: o ?? "",
94
- onChange: (u, { value: b }) => {
95
- if (typeof b != "string" || !b) return;
96
- const c = l.find((n) => n.id === b);
97
- s(b, (c == null ? void 0 : c.title) ?? "");
101
+ value: a ?? "",
102
+ onChange: (c, { value: h }) => {
103
+ if (typeof h != "string" || !h) return;
104
+ const d = t.find((u) => u.id === h);
105
+ s(h, (d == null ? void 0 : d.title) ?? "");
98
106
  },
99
107
  children: [
100
- o === void 0 && /* @__PURE__ */ e(te.Option, { id: "rubrics-rubric-selector-placeholder", value: "", children: i.rubricSelectorPlaceholder }),
101
- l.map((u) => /* @__PURE__ */ e(
102
- te.Option,
108
+ a === void 0 && /* @__PURE__ */ e(Ce.Option, { id: "rubrics-rubric-selector-placeholder", value: "", children: i.rubricSelectorPlaceholder }),
109
+ t.map((c) => /* @__PURE__ */ e(
110
+ Ce.Option,
103
111
  {
104
- id: `rubrics-rubric-selector-option-${u.id}`,
105
- value: u.id,
106
- children: u.title || i.rubricSelectorUntitled
112
+ id: `rubrics-rubric-selector-option-${c.id}`,
113
+ value: c.id,
114
+ children: c.title || i.rubricSelectorUntitled
107
115
  },
108
- u.id
116
+ c.id
109
117
  ))
110
118
  ]
111
119
  }
112
120
  ),
113
- (a == null ? void 0 : a.hasMore) && /* @__PURE__ */ e(p, { as: "div", padding: "xx-small 0 0", children: /* @__PURE__ */ e(k, { size: "x-small", color: "secondary", children: i.rubricSelectorTruncated }) })
121
+ (n == null ? void 0 : n.hasMore) && /* @__PURE__ */ e(P, { as: "div", padding: "xx-small 0 0", children: /* @__PURE__ */ e(G, { size: "x-small", color: "secondary", children: i.rubricSelectorTruncated }) })
114
122
  ] });
115
- }, Mr = ({
123
+ }, ki = ({
116
124
  rubricForm: r,
117
- canUseForGrading: o,
125
+ canUseForGrading: a,
118
126
  setRubricFormField: s
119
127
  }) => {
120
- const { translations: i } = D(), { hidePoints: a, useForGrading: d, hideScoreTotal: t, hideOutcomeResults: g } = r, l = (u) => {
121
- const b = Qe(u);
122
- s("useForGrading", b.useForGrading), s("hideScoreTotal", b.hideScoreTotal);
128
+ const { translations: i } = B(), { hidePoints: n, useForGrading: l, hideScoreTotal: o, hideOutcomeResults: m } = r, t = (c) => {
129
+ const h = Pr(c);
130
+ s("useForGrading", h.useForGrading), s("hideScoreTotal", h.hideScoreTotal);
123
131
  };
124
- return /* @__PURE__ */ m(Br, { direction: "column", gap: "small", "data-testid": "rubric-builder-assignment-settings", children: [
132
+ return /* @__PURE__ */ b(T, { direction: "column", gap: "small", "data-testid": "rubric-builder-assignment-settings", children: [
125
133
  /* @__PURE__ */ e(
126
- ne,
134
+ le,
127
135
  {
128
136
  variant: "toggle",
129
137
  label: i.hideOutcomeResultsLabel,
130
- checked: g,
131
- onChange: (u) => s("hideOutcomeResults", u.target.checked),
138
+ checked: m,
139
+ onChange: (c) => s("hideOutcomeResults", c.target.checked),
132
140
  "data-testid": "rubric-builder-hide-outcome-results"
133
141
  }
134
142
  ),
135
- !a && o && /* @__PURE__ */ e(
136
- ne,
143
+ !n && a && /* @__PURE__ */ e(
144
+ le,
137
145
  {
138
146
  variant: "toggle",
139
147
  label: i.useForGradingLabel,
140
- checked: d,
141
- onChange: (u) => l(u.target.checked),
148
+ checked: l,
149
+ onChange: (c) => t(c.target.checked),
142
150
  "data-testid": "rubric-builder-use-for-grading"
143
151
  }
144
152
  ),
145
- !a && !d && /* @__PURE__ */ e(
146
- ne,
153
+ !n && !l && /* @__PURE__ */ e(
154
+ le,
147
155
  {
148
156
  variant: "toggle",
149
157
  label: i.hideScoreTotalLabel,
150
- checked: t,
151
- onChange: (u) => s("hideScoreTotal", u.target.checked),
158
+ checked: o,
159
+ onChange: (c) => s("hideScoreTotal", c.target.checked),
152
160
  "data-testid": "rubric-builder-hide-score-total"
153
161
  }
154
162
  )
155
163
  ] });
156
- }, Z = ({
164
+ }, se = ({
157
165
  isOpen: r,
158
- heading: o,
166
+ heading: a,
159
167
  body: s,
160
168
  confirmLabel: i,
161
- cancelLabel: a,
162
- onConfirm: d,
163
- onDismiss: t,
164
- "data-testid": g
169
+ cancelLabel: n,
170
+ onConfirm: l,
171
+ onDismiss: o,
172
+ "data-testid": m
165
173
  }) => {
166
- const { translations: l } = D();
167
- return /* @__PURE__ */ m(Q, { open: r, onDismiss: t, size: "small", label: o, "data-testid": g, children: [
168
- /* @__PURE__ */ m(Q.Header, { children: [
174
+ const { translations: t } = B();
175
+ return /* @__PURE__ */ b(ne, { open: r, onDismiss: o, size: "small", label: a, "data-testid": m, children: [
176
+ /* @__PURE__ */ b(ne.Header, { children: [
169
177
  /* @__PURE__ */ e(
170
- We,
178
+ yr,
171
179
  {
172
180
  placement: "end",
173
181
  offset: "small",
174
- onClick: t,
175
- screenReaderLabel: l.close
182
+ onClick: o,
183
+ screenReaderLabel: t.close
176
184
  }
177
185
  ),
178
- /* @__PURE__ */ e(U, { level: "h2", children: o })
186
+ /* @__PURE__ */ e(V, { level: "h2", children: a })
179
187
  ] }),
180
- /* @__PURE__ */ e(Q.Body, { children: /* @__PURE__ */ e(k, { children: s }) }),
181
- /* @__PURE__ */ m(Q.Footer, { children: [
182
- /* @__PURE__ */ e(A, { onClick: t, margin: "0 x-small 0 0", children: a }),
183
- /* @__PURE__ */ e(A, { color: "primary", onClick: d, "data-testid": "confirm-modal-confirm", children: i })
188
+ /* @__PURE__ */ e(ne.Body, { children: /* @__PURE__ */ e(G, { children: s }) }),
189
+ /* @__PURE__ */ b(ne.Footer, { children: [
190
+ /* @__PURE__ */ e(H, { onClick: o, margin: "0 x-small 0 0", children: n }),
191
+ /* @__PURE__ */ e(H, { color: "primary", onClick: l, "data-testid": "confirm-modal-confirm", children: i })
184
192
  ] })
185
193
  ] });
186
- }, Ar = ({
194
+ }, Ti = ({
187
195
  criteriaCount: r,
188
- showMissingCriteriaError: o,
196
+ showMissingCriteriaError: a,
189
197
  actions: s,
190
- children: i
198
+ panel: i,
199
+ children: n
191
200
  }) => {
192
- const { translations: a } = D();
193
- return /* @__PURE__ */ m(p, { as: "section", "aria-labelledby": "rubric-builder-criteria-heading", children: [
194
- /* @__PURE__ */ m(v, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
195
- /* @__PURE__ */ e(U, { level: "h3", id: "rubric-builder-criteria-heading", children: a.rubricBuilderCriteriaHeading }),
196
- s && /* @__PURE__ */ e(v, { gap: "small", wrap: "wrap", children: s })
201
+ const { translations: l } = B();
202
+ return /* @__PURE__ */ b(P, { as: "section", "aria-labelledby": "rubric-builder-criteria-heading", children: [
203
+ /* @__PURE__ */ b(k, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
204
+ /* @__PURE__ */ e(V, { level: "h3", id: "rubric-builder-criteria-heading", children: l.rubricBuilderCriteriaHeading }),
205
+ s && /* @__PURE__ */ e(k, { gap: "small", wrap: "wrap", children: s })
197
206
  ] }),
198
- /* @__PURE__ */ e(p, { as: "div", margin: "small 0 0", children: r === 0 ? /* @__PURE__ */ e(k, { color: "secondary", children: a.rubricBuilderCriteriaEmpty }) : i }),
199
- /* @__PURE__ */ e("div", { "aria-live": "polite", children: o && r === 0 && /* @__PURE__ */ e(k, { color: "danger", "data-testid": "rubric-builder-criteria-error", children: a.rubricBuilderAddCriterionError }) })
207
+ i,
208
+ /* @__PURE__ */ e(P, { as: "div", margin: "small 0 0", children: r === 0 ? /* @__PURE__ */ e(G, { color: "secondary", children: l.rubricBuilderCriteriaEmpty }) : n }),
209
+ /* @__PURE__ */ e("div", { "aria-live": "polite", children: a && r === 0 && /* @__PURE__ */ e(G, { color: "danger", "data-testid": "rubric-builder-criteria-error", children: l.rubricBuilderAddCriterionError }) })
200
210
  ] });
201
- }, Nr = ({ points: r, onCommit: o }) => {
202
- const { translations: s } = D(), [i, a] = w(String(r));
203
- return $(() => {
204
- a(String(r));
211
+ }, Pi = ({ points: r, onCommit: a }) => {
212
+ const { translations: s } = B(), [i, n] = y(String(r));
213
+ return N(() => {
214
+ n(String(r));
205
215
  }, [r]), /* @__PURE__ */ e(
206
- F,
216
+ X,
207
217
  {
208
218
  renderLabel: s.rubricBuilderPointsPossibleLabel,
209
219
  width: "8rem",
210
220
  value: i,
211
- onChange: (d) => a(d.target.value),
212
- onBlur: (d) => {
213
- const t = Ve(d.target.value);
214
- a(String(t)), t !== r && o(t);
221
+ onChange: (l) => n(l.target.value),
222
+ onBlur: (l) => {
223
+ const o = Dr(l.target.value);
224
+ n(String(o)), o !== r && a(o);
215
225
  },
216
226
  "data-testid": "rubric-builder-points-possible"
217
227
  }
218
228
  );
219
- }, Hr = ({
229
+ }, Di = ({
220
230
  rating: r,
221
- sortableId: o,
231
+ sortableId: a,
222
232
  position: s,
223
233
  rangeStart: i,
224
- useRange: a,
225
- hidePoints: d,
226
- showNameError: t,
227
- canRemove: g,
228
- onChange: l,
229
- onPointsBlur: u,
230
- onRemove: b
234
+ useRange: n,
235
+ hidePoints: l,
236
+ showNameError: o,
237
+ canRemove: m,
238
+ onChange: t,
239
+ onPointsBlur: c,
240
+ onRemove: h
231
241
  }) => {
232
- const { translations: c, translate: n } = D(), { attributes: C, listeners: y, setNodeRef: f, transform: I, transition: P } = he({
233
- id: o
234
- }), [E, S] = w(String(r.points));
235
- $(() => {
236
- de(E) !== r.points && S(String(r.points));
242
+ const { translations: d, translate: u } = B(), { attributes: p, listeners: f, setNodeRef: C, transform: g, transition: v } = Xe({
243
+ id: a
244
+ }), [E, R] = y(String(r.points));
245
+ N(() => {
246
+ Oe(E) !== r.points && R(String(r.points));
237
247
  }, [r.points]);
238
- const B = (R, T) => {
239
- S(T), l({ ...r, points: R });
248
+ const I = (L, D) => {
249
+ R(D), t({ ...r, points: L });
240
250
  };
241
251
  return /* @__PURE__ */ e(
242
252
  "div",
243
253
  {
244
- ref: f,
245
- style: { transform: pe.Transform.toString(I), transition: P },
254
+ ref: C,
255
+ style: { transform: Ye.Transform.toString(g), transition: v },
246
256
  "data-testid": "rubric-builder-rating-row",
247
- children: /* @__PURE__ */ m(v, { gap: "small", alignItems: "start", wrap: "wrap", margin: "0 0 small", children: [
257
+ children: /* @__PURE__ */ b(k, { gap: "small", alignItems: "start", wrap: "wrap", margin: "0 0 small", children: [
248
258
  /* @__PURE__ */ e(
249
- p,
259
+ P,
250
260
  {
251
261
  as: "div",
252
262
  cursor: "grab",
253
263
  margin: "medium 0 0",
254
- "aria-label": n("rubricBuilderReorderRating", { position: s }),
255
- ...C,
256
- ...y,
257
- children: /* @__PURE__ */ e(De, { "aria-hidden": "true" })
264
+ "aria-label": u("rubricBuilderReorderRating", { position: s }),
265
+ ...p,
266
+ ...f,
267
+ children: /* @__PURE__ */ e(ar, { "aria-hidden": "true" })
258
268
  }
259
269
  ),
260
- /* @__PURE__ */ e(p, { as: "div", minWidth: "1.5rem", margin: "medium 0 0", children: /* @__PURE__ */ e(k, { weight: "bold", "aria-hidden": "true", children: s }) }),
261
- !d && /* @__PURE__ */ m(v, { gap: "x-small", alignItems: "end", children: [
262
- a && i !== void 0 && /* @__PURE__ */ e(p, { as: "div", margin: "0 0 x-small", children: /* @__PURE__ */ e(k, { children: n("rangeStartPrefix", { rangeStart: i }) }) }),
270
+ /* @__PURE__ */ e(P, { as: "div", minWidth: "1.5rem", margin: "medium 0 0", children: /* @__PURE__ */ e(G, { weight: "bold", "aria-hidden": "true", children: s }) }),
271
+ !l && /* @__PURE__ */ b(k, { gap: "x-small", alignItems: "end", children: [
272
+ n && i !== void 0 && /* @__PURE__ */ e(P, { as: "div", margin: "0 0 x-small", children: /* @__PURE__ */ e(G, { children: u("rangeStartPrefix", { rangeStart: i }) }) }),
263
273
  /* @__PURE__ */ e(
264
- Ir,
274
+ pi,
265
275
  {
266
- renderLabel: a ? c.rubricBuilderPointRangeLabel : c.rubricBuilderPointsLabel,
276
+ renderLabel: n ? d.rubricBuilderPointRangeLabel : d.rubricBuilderPointsLabel,
267
277
  allowStringValue: !0,
268
278
  showArrows: !1,
269
279
  width: "6rem",
270
280
  value: E,
271
- onChange: (R, T) => {
272
- Xe(T) && B(de(T), T);
281
+ onChange: (L, D) => {
282
+ Er(D) && I(Oe(D), D);
273
283
  },
274
284
  onIncrement: () => {
275
- const R = ce(Math.floor(r.points) + 1);
276
- B(R, String(R));
285
+ const L = Ge(Math.floor(r.points) + 1);
286
+ I(L, String(L));
277
287
  },
278
288
  onDecrement: () => {
279
- const R = ce(Math.floor(r.points) - 1);
280
- B(R, String(R));
289
+ const L = Ge(Math.floor(r.points) - 1);
290
+ I(L, String(L));
281
291
  },
282
- onBlur: u,
292
+ onBlur: c,
283
293
  "data-testid": "rubric-builder-rating-points"
284
294
  }
285
295
  )
286
296
  ] }),
287
- /* @__PURE__ */ e(v.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
288
- F,
297
+ /* @__PURE__ */ e(k.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
298
+ X,
289
299
  {
290
- renderLabel: c.rubricBuilderRatingNameLabel,
300
+ renderLabel: d.rubricBuilderRatingNameLabel,
291
301
  isRequired: !0,
292
302
  value: r.description,
293
- onChange: (R) => l({ ...r, description: R.target.value }),
294
- messages: t ? [{ text: c.rubricBuilderRatingNameRequired, type: "error" }] : [],
303
+ onChange: (L) => t({ ...r, description: L.target.value }),
304
+ messages: o ? [{ text: d.rubricBuilderRatingNameRequired, type: "error" }] : [],
295
305
  "data-testid": "rubric-builder-rating-name"
296
306
  }
297
307
  ) }),
298
- /* @__PURE__ */ e(v.Item, { shouldGrow: !0, shouldShrink: !0, size: "14rem", children: /* @__PURE__ */ e(
299
- F,
308
+ /* @__PURE__ */ e(k.Item, { shouldGrow: !0, shouldShrink: !0, size: "14rem", children: /* @__PURE__ */ e(
309
+ X,
300
310
  {
301
- renderLabel: c.rubricBuilderRatingDescriptionLabel,
311
+ renderLabel: d.rubricBuilderRatingDescriptionLabel,
302
312
  value: r.longDescription,
303
- onChange: (R) => l({ ...r, longDescription: R.target.value }),
313
+ onChange: (L) => t({ ...r, longDescription: L.target.value }),
304
314
  "data-testid": "rubric-builder-rating-description"
305
315
  }
306
316
  ) }),
307
- g && /* @__PURE__ */ e(p, { as: "div", margin: "medium 0 0", children: /* @__PURE__ */ e(
308
- Y,
317
+ m && /* @__PURE__ */ e(P, { as: "div", margin: "medium 0 0", children: /* @__PURE__ */ e(
318
+ oe,
309
319
  {
310
- screenReaderLabel: n("rubricBuilderRemoveRating", { position: s }),
320
+ screenReaderLabel: u("rubricBuilderRemoveRating", { position: s }),
311
321
  withBackground: !1,
312
322
  withBorder: !1,
313
- onClick: b,
323
+ onClick: h,
314
324
  "data-testid": "rubric-builder-remove-rating",
315
- children: /* @__PURE__ */ e(Ie, {})
325
+ children: /* @__PURE__ */ e(or, {})
316
326
  }
317
327
  ) })
318
328
  ] })
319
329
  }
320
330
  );
321
- }, Ur = ({
331
+ }, Ei = ({
322
332
  ratings: r,
323
- useRange: o,
333
+ useRange: a,
324
334
  hidePoints: s,
325
335
  ratingOrder: i,
326
- ratingNamesRequired: a,
327
- onChange: d
336
+ ratingNamesRequired: n,
337
+ onChange: l
328
338
  }) => {
329
- const { translations: t } = D(), g = fe(
330
- J(Re, { activationConstraint: { distance: 8 } }),
331
- J(ve, { coordinateGetter: Ce })
332
- ), l = r.map(Ye), u = i === "ascending", b = r.map((n, C) => u ? r.length - 1 - C : C);
333
- return /* @__PURE__ */ m(p, { as: "div", children: [
334
- /* @__PURE__ */ e(Be, { sensors: g, onDragEnd: ({ active: n, over: C }) => {
335
- if (!C || n.id === C.id) return;
336
- const y = l.indexOf(String(n.id)), f = l.indexOf(String(C.id));
337
- y === -1 || f === -1 || d(tr({ list: r, startIndex: y, endIndex: f }));
339
+ const { translations: o } = B(), m = Qe(
340
+ de(er, { activationConstraint: { distance: 8 } }),
341
+ de(Ze, { coordinateGetter: Je })
342
+ ), t = r.map(Mr), c = i === "ascending", h = r.map((u, p) => c ? r.length - 1 - p : p);
343
+ return /* @__PURE__ */ b(P, { as: "div", children: [
344
+ /* @__PURE__ */ e(rr, { sensors: m, onDragEnd: ({ active: u, over: p }) => {
345
+ if (!p || u.id === p.id) return;
346
+ const f = t.indexOf(String(u.id)), C = t.indexOf(String(p.id));
347
+ f === -1 || C === -1 || l(Nr({ list: r, startIndex: f, endIndex: C }));
338
348
  }, children: /* @__PURE__ */ e(
339
- Se,
349
+ ir,
340
350
  {
341
- items: b.map((n) => l[n]),
342
- strategy: ye,
343
- children: b.map((n, C) => /* @__PURE__ */ e(
344
- Hr,
351
+ items: h.map((u) => t[u]),
352
+ strategy: tr,
353
+ children: h.map((u, p) => /* @__PURE__ */ e(
354
+ Di,
345
355
  {
346
- rating: r[n],
347
- sortableId: l[n],
348
- position: C + 1,
349
- rangeStart: Ze(r, n),
350
- useRange: o,
356
+ rating: r[u],
357
+ sortableId: t[u],
358
+ position: p + 1,
359
+ rangeStart: xr(r, u),
360
+ useRange: a,
351
361
  hidePoints: s,
352
- showNameError: a.includes(n),
362
+ showNameError: n.includes(u),
353
363
  canRemove: r.length > 1,
354
- onChange: (y) => d(rr(r, n, y)),
355
- onPointsBlur: () => d(er(r)),
356
- onRemove: () => d(Je(r, n))
364
+ onChange: (f) => l(Gr(r, u, f)),
365
+ onPointsBlur: () => l(Or(r)),
366
+ onRemove: () => l(Ar(r, u))
357
367
  },
358
- l[n]
368
+ t[u]
359
369
  ))
360
370
  }
361
371
  ) }),
362
372
  /* @__PURE__ */ e(
363
- A,
373
+ H,
364
374
  {
365
- renderIcon: /* @__PURE__ */ e(Le, {}),
375
+ renderIcon: /* @__PURE__ */ e(lr, {}),
366
376
  withBackground: !1,
367
- onClick: () => d(ir(r, u ? 0 : r.length)),
377
+ onClick: () => l(_r(r, c ? 0 : r.length)),
368
378
  "data-testid": "rubric-builder-add-rating",
369
- children: t.rubricBuilderAddRatingLevel
379
+ children: o.rubricBuilderAddRatingLevel
370
380
  }
371
381
  )
372
382
  ] });
373
- }, _r = ({
383
+ }, Mi = ({
374
384
  criterion: r,
375
- sortableId: o,
385
+ sortableId: a,
376
386
  position: s,
377
387
  hidePoints: i,
378
- freeFormCriterionComments: a,
379
- ratingOrder: d,
380
- errors: t,
381
- showErrors: g,
382
- shouldFocusName: l,
383
- shouldFocusHandle: u,
384
- onNameFocused: b,
385
- onHandleFocused: c,
386
- onChange: n,
387
- onDuplicate: C,
388
- onDelete: y
388
+ freeFormCriterionComments: n,
389
+ ratingOrder: l,
390
+ errors: o,
391
+ showErrors: m,
392
+ shouldFocusName: t,
393
+ shouldFocusHandle: c,
394
+ onNameFocused: h,
395
+ onHandleFocused: d,
396
+ onChange: u,
397
+ onDuplicate: p,
398
+ onDelete: f
389
399
  }) => {
390
- const { translations: f, translate: I } = D(), { rubricCriterionRange: P } = _e(), { attributes: E, listeners: S, setNodeRef: B, transform: R, transition: T, isDragging: O } = he({
391
- id: o
392
- }), [x, q] = w(!r.description.trim()), [ee, _] = w(!1), N = ae(null), z = ae(null), W = g && nr(t), G = I("rubricBuilderCriterionHeading", { position: s }), H = r.description.trim(), M = H || G, j = `rubric-builder-criterion-body-${o}`;
393
- return $(() => {
394
- W && q(!0);
395
- }, [W]), $(() => {
396
- var h;
397
- l && x && ((h = N.current) == null || h.focus(), b());
398
- }, [l, x, b]), $(() => {
399
- var h;
400
- u && ((h = z.current) == null || h.focus(), c());
401
- }, [u, c]), /* @__PURE__ */ m(
400
+ const { translations: C, translate: g } = B(), { rubricCriterionRange: v } = ue(), { attributes: E, listeners: R, setNodeRef: I, transform: L, transition: D, isDragging: x } = Xe({
401
+ id: a
402
+ }), [_, O] = y(!r.description.trim()), [Q, W] = y(!1), J = F(null), Z = F(null), U = m && Fr(o), ee = g("rubricBuilderCriterionHeading", { position: s }), j = r.description.trim(), z = j || ee, K = `rubric-builder-criterion-body-${a}`;
403
+ return N(() => {
404
+ U && O(!0);
405
+ }, [U]), N(() => {
406
+ var S;
407
+ t && _ && ((S = J.current) == null || S.focus(), h());
408
+ }, [t, _, h]), N(() => {
409
+ var S;
410
+ c && ((S = Z.current) == null || S.focus(), d());
411
+ }, [c, d]), /* @__PURE__ */ b(
402
412
  "div",
403
413
  {
404
- ref: B,
405
- style: { transform: pe.Transform.toString(R), transition: T },
414
+ ref: I,
415
+ style: { transform: Ye.Transform.toString(L), transition: D },
406
416
  "data-testid": "rubric-builder-criterion-card",
407
417
  children: [
408
- /* @__PURE__ */ m(
409
- p,
418
+ /* @__PURE__ */ b(
419
+ P,
410
420
  {
411
421
  as: "section",
412
- "aria-label": M,
422
+ "aria-label": z,
413
423
  borderWidth: "small",
414
424
  borderRadius: "medium",
415
425
  padding: "small medium",
416
426
  margin: "0 0 small",
417
427
  background: "primary",
418
- shadow: O ? "above" : "none",
428
+ shadow: x ? "above" : "none",
419
429
  children: [
420
- /* @__PURE__ */ m(v, { gap: "small", alignItems: "center", wrap: "wrap", children: [
430
+ /* @__PURE__ */ b(k, { gap: "small", alignItems: "center", wrap: "wrap", children: [
421
431
  /* @__PURE__ */ e(
422
432
  "div",
423
433
  {
424
- ref: z,
425
- "aria-label": I("rubricBuilderReorderCriterion", { name: M }),
434
+ ref: Z,
435
+ "aria-label": g("rubricBuilderReorderCriterion", { name: z }),
426
436
  "data-testid": "rubric-builder-criterion-drag-handle",
427
437
  ...E,
428
- ...S,
429
- children: /* @__PURE__ */ e(De, { "aria-hidden": "true" })
438
+ ...R,
439
+ children: /* @__PURE__ */ e(ar, { "aria-hidden": "true" })
430
440
  }
431
441
  ),
432
442
  /* @__PURE__ */ e(
433
- Y,
443
+ oe,
434
444
  {
435
- screenReaderLabel: I(
436
- x ? "rubricBuilderCollapseCriterion" : "rubricBuilderExpandCriterion",
437
- { name: M }
445
+ screenReaderLabel: g(
446
+ _ ? "rubricBuilderCollapseCriterion" : "rubricBuilderExpandCriterion",
447
+ { name: z }
438
448
  ),
439
- "aria-expanded": x,
440
- "aria-controls": j,
449
+ "aria-expanded": _,
450
+ "aria-controls": K,
441
451
  withBackground: !1,
442
452
  withBorder: !1,
443
453
  size: "small",
444
- onClick: () => q((h) => !h),
454
+ onClick: () => O((S) => !S),
445
455
  "data-testid": "rubric-builder-criterion-toggle",
446
- children: x ? /* @__PURE__ */ e(fr, {}) : /* @__PURE__ */ e(Cr, {})
456
+ children: _ ? /* @__PURE__ */ e(ci, {}) : /* @__PURE__ */ e(ui, {})
447
457
  }
448
458
  ),
449
- a && /* @__PURE__ */ e(
450
- vr,
459
+ n && /* @__PURE__ */ e(
460
+ bi,
451
461
  {
452
- title: f.rubricBuilderWrittenFeedback,
462
+ title: C.rubricBuilderWrittenFeedback,
453
463
  "data-testid": "rubric-builder-criterion-written-icon"
454
464
  }
455
465
  ),
456
- /* @__PURE__ */ e(v.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ m(U, { level: "h4", children: [
457
- G,
458
- H && /* @__PURE__ */ e(k, { weight: "normal", "data-testid": "rubric-builder-criterion-name", children: `: ${H}` })
466
+ /* @__PURE__ */ e(k.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ b(V, { level: "h4", children: [
467
+ ee,
468
+ j && /* @__PURE__ */ e(G, { weight: "normal", "data-testid": "rubric-builder-criterion-name", children: `: ${j}` })
459
469
  ] }) }),
460
- !i && /* @__PURE__ */ e(we, { "data-testid": "rubric-builder-criterion-max", children: I("rubricBuilderCriterionMaxPoints", { count: r.points }) }),
470
+ !i && /* @__PURE__ */ e(cr, { "data-testid": "rubric-builder-criterion-max", children: g("rubricBuilderCriterionMaxPoints", { count: r.points }) }),
461
471
  /* @__PURE__ */ e(
462
- Y,
472
+ oe,
463
473
  {
464
- screenReaderLabel: I("rubricBuilderDuplicateCriterion", { name: M }),
474
+ screenReaderLabel: g("rubricBuilderDuplicateCriterion", { name: z }),
465
475
  withBackground: !1,
466
476
  withBorder: !1,
467
- onClick: C,
477
+ onClick: p,
468
478
  "data-testid": "rubric-builder-duplicate-criterion",
469
- children: /* @__PURE__ */ e(Rr, {})
479
+ children: /* @__PURE__ */ e(mi, {})
470
480
  }
471
481
  ),
472
482
  /* @__PURE__ */ e(
473
- Y,
483
+ oe,
474
484
  {
475
- screenReaderLabel: I("rubricBuilderDeleteCriterion", { name: M }),
485
+ screenReaderLabel: g("rubricBuilderDeleteCriterion", { name: z }),
476
486
  withBackground: !1,
477
487
  withBorder: !1,
478
- onClick: () => _(!0),
488
+ onClick: () => W(!0),
479
489
  "data-testid": "rubric-builder-delete-criterion",
480
- children: /* @__PURE__ */ e(Ie, {})
490
+ children: /* @__PURE__ */ e(or, {})
481
491
  }
482
492
  )
483
493
  ] }),
484
- x && /* @__PURE__ */ e(p, { as: "div", id: j, margin: "medium 0 0", children: /* @__PURE__ */ m(v, { direction: "column", gap: "medium", children: [
494
+ _ && /* @__PURE__ */ e(P, { as: "div", id: K, margin: "medium 0 0", children: /* @__PURE__ */ b(k, { direction: "column", gap: "medium", children: [
485
495
  /* @__PURE__ */ e(
486
- F,
496
+ X,
487
497
  {
488
- renderLabel: f.rubricBuilderCriterionNameLabel,
498
+ renderLabel: C.rubricBuilderCriterionNameLabel,
489
499
  isRequired: !0,
490
500
  value: r.description,
491
- inputRef: (h) => {
492
- N.current = h;
501
+ inputRef: (S) => {
502
+ J.current = S;
493
503
  },
494
- onChange: (h) => n({ ...r, description: h.target.value }),
495
- messages: g && t.nameRequired ? [{ text: f.rubricBuilderCriterionNameRequired, type: "error" }] : [],
504
+ onChange: (S) => u({ ...r, description: S.target.value }),
505
+ messages: m && o.nameRequired ? [{ text: C.rubricBuilderCriterionNameRequired, type: "error" }] : [],
496
506
  "data-testid": "rubric-builder-criterion-name-input"
497
507
  }
498
508
  ),
499
509
  /* @__PURE__ */ e(
500
- Dr,
510
+ hi,
501
511
  {
502
- label: f.rubricBuilderCriterionDescriptionLabel,
512
+ label: C.rubricBuilderCriterionDescriptionLabel,
503
513
  value: r.longDescription ?? "",
504
- onChange: (h) => n({ ...r, longDescription: h.target.value }),
514
+ onChange: (S) => u({ ...r, longDescription: S.target.value }),
505
515
  "data-testid": "rubric-builder-criterion-description"
506
516
  }
507
517
  ),
508
- P && !i && !a && /* @__PURE__ */ e(
509
- yr,
518
+ v && !i && !n && /* @__PURE__ */ e(
519
+ gi,
510
520
  {
511
521
  variant: "toggle",
512
- label: f.rubricBuilderEnableRange,
522
+ label: C.rubricBuilderEnableRange,
513
523
  checked: r.criterionUseRange,
514
- onChange: (h) => n({ ...r, criterionUseRange: h.target.checked }),
524
+ onChange: (S) => u({ ...r, criterionUseRange: S.target.checked }),
515
525
  "data-testid": "rubric-builder-enable-range"
516
526
  }
517
527
  ),
518
- a ? !i && /* @__PURE__ */ e(
519
- Nr,
528
+ n ? !i && /* @__PURE__ */ e(
529
+ Pi,
520
530
  {
521
531
  points: r.points,
522
- onCommit: (h) => n(
523
- ue(
532
+ onCommit: (S) => u(
533
+ _e(
524
534
  r,
525
- ar(r.ratings, h)
535
+ Hr(r.ratings, S)
526
536
  )
527
537
  )
528
538
  }
529
539
  ) : /* @__PURE__ */ e(
530
- Ur,
540
+ Ei,
531
541
  {
532
542
  ratings: r.ratings,
533
543
  useRange: r.criterionUseRange && !i,
534
544
  hidePoints: i,
535
- ratingOrder: d,
536
- ratingNamesRequired: g ? t.ratingNamesRequired : [],
537
- onChange: (h) => n(ue(r, h))
545
+ ratingOrder: l,
546
+ ratingNamesRequired: m ? o.ratingNamesRequired : [],
547
+ onChange: (S) => u(_e(r, S))
538
548
  }
539
549
  )
540
550
  ] }) })
@@ -542,127 +552,232 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
542
552
  }
543
553
  ),
544
554
  /* @__PURE__ */ e(
545
- Z,
555
+ se,
546
556
  {
547
- isOpen: ee,
548
- heading: f.rubricBuilderCriterionDeleteHeading,
549
- body: f.rubricBuilderCriterionDeleteBody,
550
- confirmLabel: f.delete,
551
- cancelLabel: f.cancel,
557
+ isOpen: Q,
558
+ heading: C.rubricBuilderCriterionDeleteHeading,
559
+ body: C.rubricBuilderCriterionDeleteBody,
560
+ confirmLabel: C.delete,
561
+ cancelLabel: C.cancel,
552
562
  onConfirm: () => {
553
- _(!1), y();
563
+ W(!1), f();
554
564
  },
555
- onDismiss: () => _(!1),
565
+ onDismiss: () => W(!1),
556
566
  "data-testid": "rubric-builder-delete-criterion-modal"
557
567
  }
558
568
  )
559
569
  ]
560
570
  }
561
571
  );
562
- }, Gr = ({
572
+ }, xi = ({
563
573
  criteria: r,
564
- hidePoints: o,
574
+ hidePoints: a,
565
575
  freeFormCriterionComments: s,
566
576
  ratingOrder: i,
567
- criteriaValidationErrors: a,
568
- showErrors: d,
569
- focusNameCriterionId: t,
570
- onFocusedName: g,
571
- onChangeCriterion: l,
572
- onDuplicateCriterion: u,
573
- onDeleteCriterion: b,
574
- onReorderCriteria: c
577
+ criteriaValidationErrors: n,
578
+ showErrors: l,
579
+ focusNameCriterionId: o,
580
+ onFocusedName: m,
581
+ onChangeCriterion: t,
582
+ onDuplicateCriterion: c,
583
+ onDeleteCriterion: h,
584
+ onReorderCriteria: d
575
585
  }) => {
576
586
  const {
577
- sortableIds: n,
578
- movedCriterionId: C,
579
- clearMovedCriterion: y,
580
- srAnnouncement: f,
581
- moveCriterionBySortableId: I
582
- } = or({ criteria: r, onReorderCriteria: c }), P = fe(
583
- J(Re, { activationConstraint: { distance: 8 } }),
584
- J(ve, { coordinateGetter: Ce })
587
+ sortableIds: u,
588
+ movedCriterionId: p,
589
+ clearMovedCriterion: f,
590
+ srAnnouncement: C,
591
+ moveCriterionBySortableId: g
592
+ } = zr({ criteria: r, onReorderCriteria: d }), v = Qe(
593
+ de(er, { activationConstraint: { distance: 8 } }),
594
+ de(Ze, { coordinateGetter: Je })
585
595
  );
586
- return /* @__PURE__ */ m(ze, { children: [
587
- /* @__PURE__ */ e(Sr, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", children: f }) }),
588
- /* @__PURE__ */ e(Be, { sensors: P, onDragEnd: ({ active: S, over: B }) => {
589
- B && I(S.id, B.id);
590
- }, children: /* @__PURE__ */ e(Se, { items: n, strategy: ye, children: r.map((S, B) => /* @__PURE__ */ e(
591
- _r,
596
+ return /* @__PURE__ */ b(Se, { children: [
597
+ /* @__PURE__ */ e(dr, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", children: C }) }),
598
+ /* @__PURE__ */ e(rr, { sensors: v, onDragEnd: ({ active: R, over: I }) => {
599
+ I && g(R.id, I.id);
600
+ }, children: /* @__PURE__ */ e(ir, { items: u, strategy: tr, children: r.map((R, I) => /* @__PURE__ */ e(
601
+ Mi,
592
602
  {
593
- criterion: S,
594
- sortableId: n[B],
595
- position: B + 1,
596
- hidePoints: o,
603
+ criterion: R,
604
+ sortableId: u[I],
605
+ position: I + 1,
606
+ hidePoints: a,
597
607
  freeFormCriterionComments: s,
598
608
  ratingOrder: i,
599
- errors: a[B],
600
- showErrors: d,
601
- shouldFocusName: S.id === t,
602
- shouldFocusHandle: S.id === C,
603
- onNameFocused: g,
604
- onHandleFocused: y,
605
- onChange: l,
606
- onDuplicate: () => u(S),
607
- onDelete: () => b(S)
609
+ errors: n[I],
610
+ showErrors: l,
611
+ shouldFocusName: R.id === o,
612
+ shouldFocusHandle: R.id === p,
613
+ onNameFocused: m,
614
+ onHandleFocused: f,
615
+ onChange: t,
616
+ onDuplicate: () => c(R),
617
+ onDelete: () => h(R)
608
618
  },
609
- n[B]
619
+ u[I]
610
620
  )) }) })
611
621
  ] });
612
- }, $r = ({
622
+ }, Ai = ({
613
623
  isOpen: r,
614
- assignmentPoints: o,
624
+ assignmentPoints: a,
615
625
  rubricPoints: s,
616
626
  onChange: i,
617
- onLeaveDifferent: a,
618
- onDismiss: d
627
+ onLeaveDifferent: n,
628
+ onDismiss: l
619
629
  }) => {
620
- const { translations: t, translate: g } = D(), { locale: l } = ge(), u = sr(s, o, l), b = u === null ? g("pointsDifferenceModalBodyZeroAssignmentPoints", { rubricPoints: s }) : g("pointsDifferenceModalBody", { assignmentPoints: o, rubricPoints: s, pointRatio: u });
621
- return /* @__PURE__ */ m(
622
- V,
630
+ const { translations: o, translate: m } = B(), { locale: t } = be(), c = $r(s, a, t), h = c === null ? m("pointsDifferenceModalBodyZeroAssignmentPoints", { rubricPoints: s }) : m("pointsDifferenceModalBody", { assignmentPoints: a, rubricPoints: s, pointRatio: c });
631
+ return /* @__PURE__ */ b(
632
+ M,
623
633
  {
624
634
  open: r,
625
- onDismiss: d,
635
+ onDismiss: l,
626
636
  size: "small",
627
- label: t.pointsDifferenceModalLabel,
637
+ label: o.pointsDifferenceModalLabel,
628
638
  "data-testid": "rubric-builder-points-difference-modal",
629
639
  children: [
630
- /* @__PURE__ */ m(V.Header, { children: [
640
+ /* @__PURE__ */ b(M.Header, { children: [
631
641
  /* @__PURE__ */ e(
632
- Lr,
642
+ Be,
633
643
  {
634
644
  placement: "end",
635
645
  offset: "small",
636
- onClick: d,
637
- screenReaderLabel: t.close
646
+ onClick: l,
647
+ screenReaderLabel: o.close
638
648
  }
639
649
  ),
640
- /* @__PURE__ */ e(wr, { level: "h2", children: t.confirmToContinueHeader })
650
+ /* @__PURE__ */ e(q, { level: "h2", children: o.confirmToContinueHeader })
641
651
  ] }),
642
- /* @__PURE__ */ e(V.Body, { children: /* @__PURE__ */ e(kr, { children: b }) }),
643
- /* @__PURE__ */ m(V.Footer, { children: [
652
+ /* @__PURE__ */ e(M.Body, { children: /* @__PURE__ */ e(Y, { children: h }) }),
653
+ /* @__PURE__ */ b(M.Footer, { children: [
644
654
  /* @__PURE__ */ e(
645
- me,
655
+ A,
646
656
  {
647
- onClick: a,
657
+ onClick: n,
648
658
  margin: "0 x-small 0 0",
649
659
  "data-testid": "rubric-builder-leave-points-different",
650
- children: t.pointsDifferenceModalLeaveDifferent
660
+ children: o.pointsDifferenceModalLeaveDifferent
651
661
  }
652
662
  ),
653
- /* @__PURE__ */ e(me, { color: "primary", onClick: i, "data-testid": "rubric-builder-change-points", children: t.pointsDifferenceModalChange })
663
+ /* @__PURE__ */ e(A, { color: "primary", onClick: i, "data-testid": "rubric-builder-change-points", children: o.pointsDifferenceModalChange })
654
664
  ] })
655
665
  ]
656
666
  }
657
667
  );
658
- }, Fr = ({
668
+ }, ur = "rubric-builder-preview", Ve = "rubric-builder-preview-heading", Oi = ["traditional", "horizontal", "vertical"], qe = () => {
669
+ }, Gi = ({
670
+ rubric: r,
671
+ savePending: a,
672
+ onClose: s,
673
+ onSave: i
674
+ }) => {
675
+ const { translations: n } = B(), l = We(), o = F(null), { currentUserId: m, locale: t } = be(), { viewMode: c, isTraditionalView: h, setViewMode: d } = Ur({
676
+ currentUserId: m ?? ""
677
+ });
678
+ N(() => {
679
+ var f;
680
+ (f = o.current) == null || f.focus();
681
+ }, []);
682
+ const u = {
683
+ traditional: n.assessmentViewModeTraditional,
684
+ horizontal: n.assessmentViewModeHorizontal,
685
+ vertical: n.assessmentViewModeVertical
686
+ }, p = () => r.criteria.length === 0 ? /* @__PURE__ */ e(Y, { children: n.rubricBuilderCriteriaEmpty }) : h ? /* @__PURE__ */ e(
687
+ Vr,
688
+ {
689
+ translations: l,
690
+ criteria: r.criteria,
691
+ hidePoints: r.hidePoints,
692
+ locale: t ?? "en",
693
+ isFreeFormCriterionComments: r.freeFormCriterionComments,
694
+ isPreviewMode: !0,
695
+ ratingOrder: r.ratingOrder,
696
+ rubricAssessmentData: [],
697
+ rubricTitle: r.title,
698
+ onUpdateAssessmentData: qe
699
+ }
700
+ ) : /* @__PURE__ */ e(
701
+ qr,
702
+ {
703
+ buttonDisplay: r.buttonDisplay,
704
+ criteria: r.criteria,
705
+ hidePoints: r.hidePoints,
706
+ locale: t ?? "en",
707
+ isPreviewMode: !0,
708
+ isPeerReview: !1,
709
+ isSelfAssessment: !1,
710
+ isFreeFormCriterionComments: r.freeFormCriterionComments,
711
+ ratingOrder: r.ratingOrder,
712
+ rubricAssessmentData: [],
713
+ selectedViewMode: c,
714
+ onUpdateAssessmentData: qe
715
+ }
716
+ );
717
+ return /* @__PURE__ */ e(
718
+ Re,
719
+ {
720
+ as: "section",
721
+ id: ur,
722
+ "aria-labelledby": Ve,
723
+ borderWidth: "small",
724
+ borderRadius: "medium",
725
+ background: "primary",
726
+ "data-testid": "rubric-builder-preview-panel",
727
+ children: /* @__PURE__ */ b(T, { direction: "column", height: "100%", children: [
728
+ /* @__PURE__ */ e(T.Item, { padding: "medium", children: /* @__PURE__ */ b(T, { justifyItems: "space-between", alignItems: "end", gap: "small", wrap: "wrap", children: [
729
+ /* @__PURE__ */ e(
730
+ q,
731
+ {
732
+ level: "h3",
733
+ id: Ve,
734
+ tabIndex: -1,
735
+ elementRef: (f) => {
736
+ o.current = f;
737
+ },
738
+ children: n.rubricBuilderPreviewHeading
739
+ }
740
+ ),
741
+ /* @__PURE__ */ e(
742
+ $,
743
+ {
744
+ renderLabel: n.assessmentViewMode,
745
+ width: "10rem",
746
+ value: c,
747
+ onChange: (f, { value: C }) => d(C),
748
+ "data-testid": "rubric-builder-preview-view-mode",
749
+ children: Oi.map((f) => /* @__PURE__ */ e($.Option, { id: `rubric-builder-preview-${f}`, value: f, children: u[f] }, f))
750
+ }
751
+ )
752
+ ] }) }),
753
+ /* @__PURE__ */ e(T.Item, { shouldGrow: !0, shouldShrink: !0, padding: "0 medium", overflowX: "auto", overflowY: "auto", children: /* @__PURE__ */ e(Re, { as: "div", "data-testid": "rubric-builder-preview-body", children: p() }) }),
754
+ /* @__PURE__ */ e(T.Item, { as: "footer", padding: "small medium", children: /* @__PURE__ */ b(T, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
755
+ /* @__PURE__ */ e(A, { onClick: s, "data-testid": "rubric-builder-preview-close", children: n.rubricBuilderPreviewClose }),
756
+ /* @__PURE__ */ e(
757
+ A,
758
+ {
759
+ color: "primary",
760
+ onClick: i,
761
+ interaction: a ? "disabled" : "enabled",
762
+ "data-testid": "rubric-builder-preview-save",
763
+ children: n.rubricBuilderPreviewSave
764
+ }
765
+ )
766
+ ] }) })
767
+ ] })
768
+ }
769
+ );
770
+ }, _i = ({
659
771
  savePending: r,
660
- onDiscard: o,
661
- onSave: s
772
+ isPreviewOpen: a,
773
+ previewToggleRef: s,
774
+ onTogglePreview: i,
775
+ onDiscard: n,
776
+ onSave: l
662
777
  }) => {
663
- const { translations: i } = D();
778
+ const { translations: o } = B();
664
779
  return /* @__PURE__ */ e(
665
- p,
780
+ P,
666
781
  {
667
782
  as: "footer",
668
783
  position: "sticky",
@@ -671,59 +786,70 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
671
786
  borderWidth: "small none none none",
672
787
  padding: "small 0",
673
788
  stacking: "above",
674
- children: /* @__PURE__ */ m(v, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
675
- /* @__PURE__ */ e(A, { onClick: o, "data-testid": "rubric-builder-discard", children: i.rubricBuilderDiscard }),
789
+ children: /* @__PURE__ */ b(k, { justifyItems: "end", gap: "small", wrap: "wrap", children: [
790
+ /* @__PURE__ */ e(
791
+ H,
792
+ {
793
+ "aria-expanded": a,
794
+ "aria-controls": ur,
795
+ onClick: i,
796
+ elementRef: (m) => s(m),
797
+ "data-testid": "rubric-builder-preview-toggle",
798
+ children: a ? o.rubricBuilderPreviewClose : o.rubricBuilderPreviewToggle
799
+ }
800
+ ),
801
+ /* @__PURE__ */ e(H, { onClick: n, "data-testid": "rubric-builder-discard", children: o.rubricBuilderDiscard }),
676
802
  /* @__PURE__ */ e(
677
- A,
803
+ H,
678
804
  {
679
805
  color: "primary",
680
- onClick: s,
806
+ onClick: l,
681
807
  interaction: r ? "disabled" : "enabled",
682
808
  "data-testid": "rubric-builder-save",
683
- children: i.rubricBuilderSave
809
+ children: o.rubricBuilderSave
684
810
  }
685
811
  )
686
812
  ] })
687
813
  }
688
814
  );
689
- }, qr = ({
815
+ }, Ni = ({
690
816
  isNewRubric: r,
691
- pointsPossible: o,
817
+ pointsPossible: a,
692
818
  hidePoints: s
693
819
  }) => {
694
- const { translations: i, translate: a } = D();
695
- return /* @__PURE__ */ m(v, { as: "header", justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
696
- /* @__PURE__ */ e(U, { level: "h2", children: r ? i.rubricBuilderCreateTitle : i.rubricBuilderEditTitle }),
697
- !s && /* @__PURE__ */ e(we, { "data-testid": "rubric-builder-current-total", children: a("rubricBuilderCurrentTotal", { count: o }) })
820
+ const { translations: i, translate: n } = B();
821
+ return /* @__PURE__ */ b(k, { as: "header", justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
822
+ /* @__PURE__ */ e(V, { level: "h2", children: r ? i.rubricBuilderCreateTitle : i.rubricBuilderEditTitle }),
823
+ !s && /* @__PURE__ */ e(cr, { "data-testid": "rubric-builder-current-total", children: n("rubricBuilderCurrentTotal", { count: a }) })
698
824
  ] });
699
- }, X = ({ name: r, label: o, value: s, options: i, onChange: a }) => /* @__PURE__ */ e(
700
- Tr,
825
+ }, ae = ({ name: r, label: a, value: s, options: i, onChange: n }) => /* @__PURE__ */ e(
826
+ fi,
701
827
  {
702
828
  name: r,
703
- description: o,
829
+ description: a,
704
830
  variant: "toggle",
705
831
  layout: "columns",
706
832
  value: s,
707
- onChange: (d, t) => a(t),
708
- children: i.map((d) => /* @__PURE__ */ e(xr, { value: d.value, label: d.label }, d.value))
833
+ onChange: (l, o) => n(o),
834
+ children: i.map((l) => /* @__PURE__ */ e(Ci, { value: l.value, label: l.label }, l.value))
709
835
  }
710
- ), zr = ({
836
+ ), Fi = ({
711
837
  rubricForm: r,
712
- setRubricFormField: o,
838
+ setRubricFormField: a,
713
839
  validateTitle: s,
714
840
  titleError: i,
715
- titleInputRef: a,
716
- assignmentSettings: d
841
+ titleInputRef: n,
842
+ assignmentSettings: l
717
843
  }) => {
718
- const { translations: t } = D(), g = (l) => {
719
- if (l === "unscored" === r.hidePoints) return;
720
- const { hidePoints: u, hideScoreTotal: b, useForGrading: c, buttonDisplay: n } = lr(
844
+ const { translations: o } = B(), m = (t) => {
845
+ if (t === "unscored" === r.hidePoints) return;
846
+ const { hidePoints: c, hideScoreTotal: h, useForGrading: d, buttonDisplay: u } = Wr(
721
847
  r.hidePoints
722
848
  );
723
- o("hidePoints", u), o("hideScoreTotal", b), o("useForGrading", c), n && o("buttonDisplay", n);
849
+ a("hidePoints", c), a("hideScoreTotal", h), a("useForGrading", d), u && a("buttonDisplay", u);
724
850
  };
725
- return /* @__PURE__ */ m(
726
- p,
851
+ return /* @__PURE__ */ b(
852
+ P,
727
853
  {
728
854
  as: "section",
729
855
  "aria-labelledby": "rubric-builder-details-heading",
@@ -731,310 +857,917 @@ const Di = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children
731
857
  borderRadius: "medium",
732
858
  padding: "medium",
733
859
  children: [
734
- /* @__PURE__ */ e(U, { level: "h3", id: "rubric-builder-details-heading", margin: "0 0 medium", children: t.rubricBuilderDetailsHeading }),
735
- /* @__PURE__ */ m(v, { direction: "column", gap: "medium", children: [
860
+ /* @__PURE__ */ e(V, { level: "h3", id: "rubric-builder-details-heading", margin: "0 0 medium", children: o.rubricBuilderDetailsHeading }),
861
+ /* @__PURE__ */ b(k, { direction: "column", gap: "medium", children: [
736
862
  /* @__PURE__ */ e(
737
- F,
863
+ X,
738
864
  {
739
865
  "data-testid": "rubric-builder-name",
740
- renderLabel: t.rubricBuilderNameLabel,
866
+ renderLabel: o.rubricBuilderNameLabel,
741
867
  isRequired: !0,
742
868
  value: r.title,
743
- inputRef: a,
744
- onChange: (l) => o("title", l.target.value),
745
- onBlur: (l) => s(l.target.value),
869
+ inputRef: n,
870
+ onChange: (t) => a("title", t.target.value),
871
+ onBlur: (t) => s(t.target.value),
746
872
  messages: i ? [{ text: i, type: "error" }] : []
747
873
  }
748
874
  ),
749
- /* @__PURE__ */ m(v, { gap: "medium", wrap: "wrap", children: [
875
+ /* @__PURE__ */ b(k, { gap: "medium", wrap: "wrap", children: [
750
876
  /* @__PURE__ */ e(
751
- X,
877
+ ae,
752
878
  {
753
879
  name: "rubric-builder-scoring",
754
- label: t.scoringTypeSelectLabel,
880
+ label: o.scoringTypeSelectLabel,
755
881
  value: r.hidePoints ? "unscored" : "scored",
756
882
  options: [
757
- { value: "scored", label: t.scoringTypeScored },
758
- { value: "unscored", label: t.scoringTypeUnscored }
883
+ { value: "scored", label: o.scoringTypeScored },
884
+ { value: "unscored", label: o.scoringTypeUnscored }
759
885
  ],
760
- onChange: g
886
+ onChange: m
761
887
  }
762
888
  ),
763
889
  !r.hidePoints && !r.freeFormCriterionComments && /* @__PURE__ */ e(
764
- X,
890
+ ae,
765
891
  {
766
892
  name: "rubric-builder-display",
767
- label: t.rubricBuilderDisplayLabel,
893
+ label: o.rubricBuilderDisplayLabel,
768
894
  value: r.buttonDisplay,
769
895
  options: [
770
- { value: "points", label: t.ratingDisplayPoints },
771
- { value: "numeric", label: t.ratingDisplayLevel }
896
+ { value: "points", label: o.ratingDisplayPoints },
897
+ { value: "numeric", label: o.ratingDisplayLevel }
772
898
  ],
773
- onChange: (l) => o("buttonDisplay", l)
899
+ onChange: (t) => a("buttonDisplay", t)
774
900
  }
775
901
  ),
776
902
  /* @__PURE__ */ e(
777
- X,
903
+ ae,
778
904
  {
779
905
  name: "rubric-builder-feedback",
780
- label: t.rubricBuilderFeedbackLabel,
906
+ label: o.rubricBuilderFeedbackLabel,
781
907
  value: r.freeFormCriterionComments ? "freeForm" : "scale",
782
908
  options: [
783
- { value: "scale", label: t.gradingTypeScale },
784
- { value: "freeForm", label: t.rubricBuilderFeedbackWrittenOnly }
909
+ { value: "scale", label: o.gradingTypeScale },
910
+ { value: "freeForm", label: o.rubricBuilderFeedbackWrittenOnly }
785
911
  ],
786
- onChange: (l) => o("freeFormCriterionComments", l === "freeForm")
912
+ onChange: (t) => a("freeFormCriterionComments", t === "freeForm")
787
913
  }
788
914
  ),
789
915
  !r.freeFormCriterionComments && /* @__PURE__ */ e(
790
- X,
916
+ ae,
791
917
  {
792
918
  name: "rubric-builder-rating-order",
793
- label: t.rubricBuilderRatingOrderLabel,
919
+ label: o.rubricBuilderRatingOrderLabel,
794
920
  value: r.ratingOrder,
795
921
  options: [
796
- { value: "ascending", label: t.rubricBuilderRatingOrderLowToHigh },
797
- { value: "descending", label: t.rubricBuilderRatingOrderHighToLow }
922
+ { value: "ascending", label: o.rubricBuilderRatingOrderLowToHigh },
923
+ { value: "descending", label: o.rubricBuilderRatingOrderHighToLow }
798
924
  ],
799
- onChange: (l) => o("ratingOrder", l)
925
+ onChange: (t) => a("ratingOrder", t)
800
926
  }
801
927
  )
802
928
  ] }),
803
- d
929
+ l
804
930
  ] })
805
931
  ]
806
932
  }
807
933
  );
808
- }, Ii = (r) => /* @__PURE__ */ e(be, { translations: r.translations, children: /* @__PURE__ */ e(
809
- Ge,
934
+ }, Hi = ({
935
+ options: r,
936
+ maxCriterionCount: a,
937
+ maxRatingCount: s,
938
+ rangeEnabled: i,
939
+ isPending: n,
940
+ onChange: l,
941
+ onGenerate: o,
942
+ onCancel: m
943
+ }) => {
944
+ const { translations: t } = B(), [c, h] = y(!1), d = (g, v) => l({ ...r, [g]: v }), u = Ne(r.totalPoints), p = r.standard.length > ve, f = r.additionalPromptInfo.length > ve, C = () => {
945
+ if (!u) {
946
+ h(!0);
947
+ return;
948
+ }
949
+ o();
950
+ };
951
+ return /* @__PURE__ */ b(T, { direction: "column", gap: "medium", "data-testid": "rubric-builder-generator-form", children: [
952
+ /* @__PURE__ */ b(T, { gap: "small", wrap: "wrap", alignItems: "start", children: [
953
+ /* @__PURE__ */ e(T.Item, { shouldGrow: !0, shouldShrink: !0, size: "12rem", children: /* @__PURE__ */ e(
954
+ $,
955
+ {
956
+ renderLabel: t.rubricBuilderGeneratorDifficultyLabel,
957
+ value: r.gradeLevel,
958
+ onChange: (g, { value: v }) => v && d("gradeLevel", String(v)),
959
+ "data-testid": "rubric-builder-generator-difficulty",
960
+ children: jr.map((g) => /* @__PURE__ */ e($.Option, { id: `rubric-builder-grade-level-${g}`, value: g, children: t[Kr[g]] }, g))
961
+ }
962
+ ) }),
963
+ /* @__PURE__ */ e(T.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
964
+ $,
965
+ {
966
+ renderLabel: t.rubricBuilderGeneratorCriteriaCountLabel,
967
+ isRequired: !0,
968
+ value: String(r.criteriaCount),
969
+ onChange: (g, { value: v }) => v && d("criteriaCount", Number(v)),
970
+ "data-testid": "rubric-builder-generator-criteria-count",
971
+ children: Fe(a).map((g) => /* @__PURE__ */ e(
972
+ $.Option,
973
+ {
974
+ id: `rubric-builder-criteria-count-${g}`,
975
+ value: String(g),
976
+ children: String(g)
977
+ },
978
+ g
979
+ ))
980
+ }
981
+ ) }),
982
+ /* @__PURE__ */ e(T.Item, { shouldGrow: !0, shouldShrink: !0, size: "10rem", children: /* @__PURE__ */ e(
983
+ $,
984
+ {
985
+ renderLabel: t.rubricBuilderGeneratorRatingCountLabel,
986
+ isRequired: !0,
987
+ value: String(r.ratingCount),
988
+ onChange: (g, { value: v }) => v && d("ratingCount", Number(v)),
989
+ "data-testid": "rubric-builder-generator-rating-count",
990
+ children: Fe(s).map((g) => /* @__PURE__ */ e(
991
+ $.Option,
992
+ {
993
+ id: `rubric-builder-rating-count-${g}`,
994
+ value: String(g),
995
+ children: String(g)
996
+ },
997
+ g
998
+ ))
999
+ }
1000
+ ) }),
1001
+ /* @__PURE__ */ e(T.Item, { shouldGrow: !0, shouldShrink: !0, size: "8rem", children: /* @__PURE__ */ e(
1002
+ wi,
1003
+ {
1004
+ renderLabel: t.generateCriteriaTotalPointsLabel,
1005
+ isRequired: !0,
1006
+ value: r.totalPoints,
1007
+ onChange: (g, v) => {
1008
+ d("totalPoints", v), Ne(v) && h(!1);
1009
+ },
1010
+ messages: c && !u ? [{ text: t.generateCriteriaTotalPointsError, type: "error" }] : [],
1011
+ "data-testid": "rubric-builder-generator-total-points"
1012
+ }
1013
+ ) })
1014
+ ] }),
1015
+ i && /* @__PURE__ */ e(
1016
+ le,
1017
+ {
1018
+ variant: "toggle",
1019
+ label: t.rubricBuilderEnableRange,
1020
+ checked: r.useRange,
1021
+ onChange: (g) => d("useRange", g.target.checked),
1022
+ "data-testid": "rubric-builder-generator-use-range"
1023
+ }
1024
+ ),
1025
+ /* @__PURE__ */ e(
1026
+ ce,
1027
+ {
1028
+ label: t.rubricBuilderGeneratorStandardLabel,
1029
+ placeholder: t.standardObjectivePlaceholder,
1030
+ value: r.standard,
1031
+ onChange: (g) => d("standard", g.target.value),
1032
+ messages: p ? [{ text: t.standardObjectiveTooLong, type: "error" }] : [],
1033
+ "data-testid": "rubric-builder-generator-standard"
1034
+ }
1035
+ ),
1036
+ /* @__PURE__ */ e(
1037
+ ce,
1038
+ {
1039
+ label: t.rubricBuilderGeneratorAdditionalLabel,
1040
+ placeholder: t.generateCriteriaAdditionalPromptPlaceholder,
1041
+ value: r.additionalPromptInfo,
1042
+ onChange: (g) => d("additionalPromptInfo", g.target.value),
1043
+ messages: f ? [{ text: t.generateCriteriaAdditionalPromptTooLong, type: "error" }] : [],
1044
+ "data-testid": "rubric-builder-generator-additional"
1045
+ }
1046
+ ),
1047
+ /* @__PURE__ */ b(T, { justifyItems: "end", gap: "small", children: [
1048
+ /* @__PURE__ */ e(
1049
+ A,
1050
+ {
1051
+ onClick: m,
1052
+ disabled: n,
1053
+ "data-testid": "rubric-builder-generator-cancel",
1054
+ children: t.cancel
1055
+ }
1056
+ ),
1057
+ /* @__PURE__ */ e(
1058
+ A,
1059
+ {
1060
+ color: "ai-primary",
1061
+ renderIcon: /* @__PURE__ */ e(me, {}),
1062
+ onClick: C,
1063
+ disabled: n || p || f,
1064
+ "data-testid": "rubric-builder-generator-generate",
1065
+ children: t.rubricBuilderGeneratorGenerate
1066
+ }
1067
+ )
1068
+ ] })
1069
+ ] });
1070
+ }, zi = ({
1071
+ courseId: r,
1072
+ responseId: a,
1073
+ responseType: s
1074
+ }) => {
1075
+ const { translations: i, translate: n } = B(), { locale: l } = be(), [o, m] = y(null), [t, c] = y(null), [h, d] = y("");
1076
+ N(() => {
1077
+ m(null), c(null);
1078
+ }, [a]);
1079
+ const u = () => {
1080
+ d(""), c(null);
1081
+ }, { submitFeedback: p, isPending: f } = Xr({
1082
+ courseId: r,
1083
+ responseId: a,
1084
+ responseType: s,
1085
+ onSubmitted: () => {
1086
+ m(t), u();
1087
+ }
1088
+ }), C = t ?? o, g = h.length > He, v = t === "positive" ? i.positiveFeedbackLabel : i.negativeFeedbackLabel, E = (R) => {
1089
+ o !== R && c(R);
1090
+ };
1091
+ return /* @__PURE__ */ b(Se, { children: [
1092
+ /* @__PURE__ */ b(T, { alignItems: "center", gap: "xx-small", "data-testid": "rubric-builder-generator-feedback", children: [
1093
+ /* @__PURE__ */ e(Y, { children: i.generatedCriteriaFeedbackLabel }),
1094
+ /* @__PURE__ */ e(
1095
+ Ue,
1096
+ {
1097
+ withBackground: !1,
1098
+ withBorder: !1,
1099
+ size: "small",
1100
+ screenReaderLabel: i.positiveFeedbackLabel,
1101
+ "aria-pressed": C === "positive",
1102
+ onClick: () => E("positive"),
1103
+ "data-testid": "rubric-builder-generator-feedback-positive",
1104
+ children: C === "positive" ? /* @__PURE__ */ e(ze, {}) : /* @__PURE__ */ e($e, {})
1105
+ }
1106
+ ),
1107
+ /* @__PURE__ */ e(
1108
+ Ue,
1109
+ {
1110
+ withBackground: !1,
1111
+ withBorder: !1,
1112
+ size: "small",
1113
+ screenReaderLabel: i.negativeFeedbackLabel,
1114
+ "aria-pressed": C === "negative",
1115
+ onClick: () => E("negative"),
1116
+ "data-testid": "rubric-builder-generator-feedback-negative",
1117
+ children: C === "negative" ? /* @__PURE__ */ e(ze, { rotate: "180" }) : /* @__PURE__ */ e($e, { rotate: "180" })
1118
+ }
1119
+ )
1120
+ ] }),
1121
+ /* @__PURE__ */ b(
1122
+ M,
1123
+ {
1124
+ open: t != null,
1125
+ onDismiss: f ? void 0 : u,
1126
+ size: "medium",
1127
+ label: v,
1128
+ shouldCloseOnDocumentClick: !1,
1129
+ "data-testid": "rubric-builder-generator-feedback-modal",
1130
+ children: [
1131
+ /* @__PURE__ */ b(M.Header, { children: [
1132
+ /* @__PURE__ */ e(
1133
+ Be,
1134
+ {
1135
+ placement: "end",
1136
+ offset: "small",
1137
+ onClick: u,
1138
+ screenReaderLabel: i.feedbackModalCancelLabel
1139
+ }
1140
+ ),
1141
+ /* @__PURE__ */ e(q, { level: "h2", children: v })
1142
+ ] }),
1143
+ /* @__PURE__ */ b(M.Body, { children: [
1144
+ /* @__PURE__ */ e(Y, { as: "p", children: i.feedbackModalDescription }),
1145
+ /* @__PURE__ */ e(
1146
+ ce,
1147
+ {
1148
+ label: i.feedbackModalCommentLabel,
1149
+ placeholder: i.feedbackModalCommentPlaceholder,
1150
+ value: h,
1151
+ disabled: f,
1152
+ onChange: (R) => d(R.target.value),
1153
+ messages: g ? [
1154
+ {
1155
+ text: n("feedbackModalCommentTooLong", {
1156
+ limit: new Intl.NumberFormat(l).format(He)
1157
+ }),
1158
+ type: "error"
1159
+ }
1160
+ ] : [],
1161
+ "data-testid": "rubric-builder-generator-feedback-comment"
1162
+ }
1163
+ )
1164
+ ] }),
1165
+ /* @__PURE__ */ b(M.Footer, { children: [
1166
+ /* @__PURE__ */ e(A, { onClick: u, disabled: f, margin: "0 x-small 0 0", children: i.cancel }),
1167
+ /* @__PURE__ */ e(
1168
+ A,
1169
+ {
1170
+ color: "primary",
1171
+ disabled: g || f,
1172
+ onClick: () => t && p({ feedbackType: t, comment: h }),
1173
+ "data-testid": "rubric-builder-generator-feedback-submit",
1174
+ children: f ? i.feedbackModalSubmitting : i.feedbackModalSubmit
1175
+ }
1176
+ )
1177
+ ] })
1178
+ ]
1179
+ }
1180
+ )
1181
+ ] });
1182
+ }, $i = ({
1183
+ isOpen: r,
1184
+ onRegenerate: a,
1185
+ onDismiss: s
1186
+ }) => {
1187
+ const { translations: i } = B(), n = F(null), [l, o] = y(""), m = l.length > ve, t = () => {
1188
+ o(""), s();
1189
+ };
1190
+ return /* @__PURE__ */ b(
1191
+ M,
1192
+ {
1193
+ open: r,
1194
+ onDismiss: t,
1195
+ size: "medium",
1196
+ label: i.regenerateModalCriteriaLabel,
1197
+ shouldCloseOnDocumentClick: !1,
1198
+ defaultFocusElement: () => n.current,
1199
+ "data-testid": "rubric-builder-regenerate-modal",
1200
+ children: [
1201
+ /* @__PURE__ */ b(M.Header, { children: [
1202
+ /* @__PURE__ */ e(Be, { placement: "end", offset: "small", onClick: t, screenReaderLabel: i.close }),
1203
+ /* @__PURE__ */ e(q, { level: "h2", children: i.regenerateModalCriteriaLabel })
1204
+ ] }),
1205
+ /* @__PURE__ */ b(M.Body, { children: [
1206
+ /* @__PURE__ */ e(Y, { as: "p", children: i.regenerateModalDescriptionCriteria }),
1207
+ /* @__PURE__ */ e(
1208
+ ce,
1209
+ {
1210
+ label: i.regenerateModalPromptLabel,
1211
+ placeholder: i.regenerateModalPromptPlaceholder,
1212
+ value: l,
1213
+ textareaRef: (c) => {
1214
+ n.current = c;
1215
+ },
1216
+ onChange: (c) => o(c.target.value),
1217
+ messages: m ? [{ text: i.regenerateModalPromptTooLong, type: "error" }] : [],
1218
+ "data-testid": "rubric-builder-regenerate-prompt"
1219
+ }
1220
+ )
1221
+ ] }),
1222
+ /* @__PURE__ */ b(M.Footer, { children: [
1223
+ /* @__PURE__ */ e(A, { onClick: t, margin: "0 x-small 0 0", children: i.cancel }),
1224
+ /* @__PURE__ */ e(
1225
+ A,
1226
+ {
1227
+ color: "ai-primary",
1228
+ renderIcon: /* @__PURE__ */ e(me, {}),
1229
+ disabled: m,
1230
+ onClick: () => {
1231
+ a(l), t();
1232
+ },
1233
+ "data-testid": "rubric-builder-regenerate-submit",
1234
+ children: i.regenerateButtonLabel
1235
+ }
1236
+ )
1237
+ ] })
1238
+ ]
1239
+ }
1240
+ );
1241
+ }, Ui = ({
1242
+ courseId: r,
1243
+ responseId: a,
1244
+ responseType: s,
1245
+ canRegenerate: i,
1246
+ isPending: n,
1247
+ onRegenerate: l
1248
+ }) => {
1249
+ const { translations: o } = B(), m = F(null), [t, c] = y(!1);
1250
+ N(() => {
1251
+ var d;
1252
+ (d = m.current) == null || d.focus();
1253
+ }, []);
1254
+ const h = /* @__PURE__ */ e(
1255
+ A,
1256
+ {
1257
+ color: "ai-secondary",
1258
+ renderIcon: /* @__PURE__ */ e(me, {}),
1259
+ disabled: n || !i,
1260
+ onClick: () => c(!0),
1261
+ "data-testid": "rubric-builder-generator-regenerate",
1262
+ children: o.regenerateButtonLabel
1263
+ }
1264
+ );
1265
+ return /* @__PURE__ */ b(T, { direction: "column", gap: "small", "data-testid": "rubric-builder-generator-summary", children: [
1266
+ /* @__PURE__ */ e(
1267
+ q,
1268
+ {
1269
+ level: "h4",
1270
+ elementRef: (d) => {
1271
+ m.current = d;
1272
+ },
1273
+ tabIndex: -1,
1274
+ children: o.rubricBuilderGeneratorDoneHeading
1275
+ }
1276
+ ),
1277
+ /* @__PURE__ */ b(T, { justifyItems: "space-between", alignItems: "center", wrap: "wrap", gap: "small", children: [
1278
+ a ? /* @__PURE__ */ e(
1279
+ zi,
1280
+ {
1281
+ courseId: r,
1282
+ responseId: a,
1283
+ responseType: s
1284
+ }
1285
+ ) : /* @__PURE__ */ e("span", {}),
1286
+ i ? h : /* @__PURE__ */ e(Si, { renderTip: o.noCriteriaForRegenerationTooltip, children: h })
1287
+ ] }),
1288
+ /* @__PURE__ */ e(
1289
+ $i,
1290
+ {
1291
+ isOpen: t,
1292
+ onRegenerate: l,
1293
+ onDismiss: () => c(!1)
1294
+ }
1295
+ )
1296
+ ] });
1297
+ }, br = "rubric-builder-generator", Vi = ({
1298
+ courseId: r,
1299
+ generator: a,
1300
+ onCancel: s
1301
+ }) => {
1302
+ const { translations: i } = B(), { aiRubricsMaxCriterionCount: n, aiRubricsMaxRatingCount: l, rubricCriterionRange: o } = ue(), { isPending: m, progress: t } = a, c = t == null ? void 0 : t.completion;
1303
+ return /* @__PURE__ */ e(
1304
+ Re,
1305
+ {
1306
+ as: "section",
1307
+ id: br,
1308
+ "aria-labelledby": "rubric-builder-generator-heading",
1309
+ borderWidth: "small",
1310
+ borderRadius: "medium",
1311
+ padding: "medium",
1312
+ margin: "small 0 0",
1313
+ background: "secondary",
1314
+ "data-testid": "rubric-builder-generator-panel",
1315
+ children: /* @__PURE__ */ b(T, { direction: "column", gap: "medium", children: [
1316
+ /* @__PURE__ */ b(T, { alignItems: "center", gap: "small", children: [
1317
+ /* @__PURE__ */ e(sr, {}),
1318
+ /* @__PURE__ */ e(q, { level: "h4", id: "rubric-builder-generator-heading", children: i.rubricBuilderGeneratorToggle }),
1319
+ /* @__PURE__ */ e(Yr, { enabled: !0 })
1320
+ ] }),
1321
+ m && (typeof c == "number" ? /* @__PURE__ */ e(
1322
+ vi,
1323
+ {
1324
+ screenReaderLabel: i.rubricBuilderGeneratorGenerating,
1325
+ valueNow: c,
1326
+ valueMax: 100,
1327
+ "data-testid": "rubric-builder-generator-progress"
1328
+ }
1329
+ ) : /* @__PURE__ */ e(
1330
+ Ri,
1331
+ {
1332
+ size: "small",
1333
+ renderTitle: i.rubricBuilderGeneratorGenerating,
1334
+ "data-testid": "rubric-builder-generator-progress"
1335
+ }
1336
+ )),
1337
+ a.isGenerated ? /* @__PURE__ */ e(
1338
+ Ui,
1339
+ {
1340
+ courseId: r,
1341
+ responseId: a.feedbackResponseId,
1342
+ responseType: a.feedbackResponseType,
1343
+ canRegenerate: a.canRegenerate,
1344
+ isPending: m,
1345
+ onRegenerate: a.regenerateAll
1346
+ }
1347
+ ) : /* @__PURE__ */ e(
1348
+ Hi,
1349
+ {
1350
+ options: a.options,
1351
+ maxCriterionCount: n,
1352
+ maxRatingCount: l,
1353
+ rangeEnabled: o,
1354
+ isPending: m,
1355
+ onChange: a.setOptions,
1356
+ onGenerate: a.generate,
1357
+ onCancel: s
1358
+ }
1359
+ )
1360
+ ] })
1361
+ }
1362
+ );
1363
+ }, qi = ({ generator: r }) => {
1364
+ const { translations: a, translate: s } = B(), { isPending: i, lastResult: n } = r, l = i ? a.rubricBuilderGeneratorGenerating : (n == null ? void 0 : n.kind) === "generated" ? s("rubricBuilderGeneratorAdded", { count: n.count }) : (n == null ? void 0 : n.kind) === "regenerated" ? a.rubricBuilderGeneratorRegenerated : "";
1365
+ return /* @__PURE__ */ e(dr, { children: /* @__PURE__ */ e("div", { "aria-live": "polite", "aria-atomic": "true", "data-testid": "rubric-builder-generator-status", children: l }) });
1366
+ }, Wi = (r) => {
1367
+ try {
1368
+ return ri(r).criteria.length;
1369
+ } catch {
1370
+ return 0;
1371
+ }
1372
+ }, ji = ({
1373
+ courseId: r,
1374
+ assignmentId: a,
1375
+ assignmentPointsPossible: s,
1376
+ criteria: i,
1377
+ criteriaRef: n,
1378
+ setRubricFormField: l
1379
+ }) => {
1380
+ const { aiRubricsMaxCriterionCount: o, aiRubricsMaxRatingCount: m } = ue(), t = Ae(
1381
+ () => Qr({
1382
+ maxCriterionCount: o,
1383
+ maxRatingCount: m,
1384
+ assignmentPointsPossible: s
1385
+ }),
1386
+ [o, m, s]
1387
+ ), [c, h] = y(t), d = Ke(() => h(t), [t]), {
1388
+ generateCriteriaProgress: u,
1389
+ generateCriteriaIsPending: p,
1390
+ generateCriteriaIsSuccess: f,
1391
+ generateCriteriaMutation: C,
1392
+ generateResponseId: g
1393
+ } = Jr({
1394
+ courseId: r,
1395
+ assignmentId: a,
1396
+ generateOptions: c,
1397
+ criteriaRef: n,
1398
+ setRubricFormField: l
1399
+ }), {
1400
+ regeneratedCriteriaProgress: v,
1401
+ regenerateCriteriaIsPending: E,
1402
+ regenerateCriteriaIsSuccess: R,
1403
+ regenerateAllCriteria: I,
1404
+ regenerateResponseId: L,
1405
+ regenerateResponseType: D
1406
+ } = Zr({
1407
+ courseId: r,
1408
+ assignmentId: a,
1409
+ criteriaRef: n,
1410
+ generateOptions: c,
1411
+ setRubricFormField: l
1412
+ }), x = Ae(
1413
+ () => f ? Wi(u == null ? void 0 : u.results) : 0,
1414
+ [f, u]
1415
+ );
1416
+ return {
1417
+ options: c,
1418
+ setOptions: h,
1419
+ resetOptions: d,
1420
+ generate: () => C(),
1421
+ regenerateAll: I,
1422
+ isPending: p || E,
1423
+ progress: E ? v : u,
1424
+ isGenerated: f,
1425
+ lastResult: R ? { kind: "regenerated" } : f ? { kind: "generated", count: x } : null,
1426
+ // Outcome-linked criteria can't be regenerated, so there must be another one.
1427
+ canRegenerate: i.some((O) => !O.learningOutcomeId),
1428
+ feedbackResponseId: L ?? g ?? "",
1429
+ feedbackResponseType: D ?? ei.GENERATE_CRITERIA
1430
+ };
1431
+ }, Ki = (r) => /* @__PURE__ */ e(we, { translations: r.translations, children: /* @__PURE__ */ e(
1432
+ je,
810
1433
  {
811
1434
  courseId: r.courseId,
812
1435
  accountId: r.accountId,
813
1436
  featureFlags: r.featureFlags,
814
1437
  aiLimits: r.aiLimits,
815
- children: /* @__PURE__ */ e(Wr, { ...r })
1438
+ children: /* @__PURE__ */ e(Xi, { ...r })
816
1439
  }
817
- ) }), Wr = ({
1440
+ ) }), Xi = ({
818
1441
  rubricId: r,
819
- rubric: o,
1442
+ rubric: a,
820
1443
  rubricAssociation: s,
821
1444
  assignmentId: i,
822
- assignmentPointsPossible: a,
823
- canUseForGrading: d = !0,
824
- accountId: t,
825
- courseId: g,
826
- canManageRubrics: l,
827
- onSaveRubric: u,
828
- onDiscard: b
1445
+ assignmentPointsPossible: n,
1446
+ canUseForGrading: l = !0,
1447
+ accountId: o,
1448
+ courseId: m,
1449
+ canManageRubrics: t,
1450
+ onSaveRubric: c,
1451
+ onDiscard: h
829
1452
  }) => {
830
- var se;
831
- const { translations: c } = D(), {
832
- rubricForm: n,
1453
+ var Me;
1454
+ const { translations: d } = B(), { aiRubricsEnabled: u } = ue(), {
1455
+ rubricForm: p,
1456
+ criteriaRef: f,
833
1457
  setRubricFormField: C,
834
- validateField: y,
835
- validationErrors: f,
836
- isNewRubric: I,
837
- load: { data: P, isLoading: E, isError: S, isSuccess: B },
838
- savePending: R,
839
- saveError: T,
1458
+ validateField: g,
1459
+ validationErrors: v,
1460
+ isNewRubric: E,
1461
+ load: { data: R, isLoading: I, isError: L, isSuccess: D },
1462
+ savePending: x,
1463
+ saveError: _,
840
1464
  save: O,
841
- saveAction: x,
842
- isDirty: q,
843
- criteriaValid: ee,
844
- criteriaValidationErrors: _,
845
- saveCriterion: N,
846
- deleteCriterion: z,
847
- reorderCriteria: W
848
- } = dr({
1465
+ saveAction: Q,
1466
+ isDirty: W,
1467
+ criteriaValid: J,
1468
+ criteriaValidationErrors: Z,
1469
+ saveCriterion: U,
1470
+ deleteCriterion: ee,
1471
+ reorderCriteria: j
1472
+ } = ii({
849
1473
  rubricId: r,
850
- rubric: o,
1474
+ rubric: a,
851
1475
  rubricAssociation: s,
852
1476
  assignmentId: i,
853
- assignmentPointsPossible: a,
854
- accountId: t,
855
- courseId: g,
856
- canManageRubrics: l,
857
- onSaveRubric: u
858
- }), G = ae(null), [H, M] = w(!1), [j, h] = w(!1), [ke, re] = w(!1), [Te, ie] = w(!1), [xe, K] = w(!1), [Pe, oe] = w(), Ee = cr(), Oe = qe(() => oe(void 0), []);
859
- if (r && E)
860
- return /* @__PURE__ */ e(hr, {});
861
- if (r && S)
862
- return $e({
863
- errorImageUrl: ur,
864
- errorCategory: c.rubricErrorPageCategory,
865
- translations: le(c)
1477
+ assignmentPointsPossible: n,
1478
+ accountId: o,
1479
+ courseId: m,
1480
+ canManageRubrics: t,
1481
+ onSaveRubric: c
1482
+ }), z = F(null), [K, S] = y(!1), [mr, Ie] = y(!1), [gr, ge] = y(!1), [hr, he] = y(!1), [pr, re] = y(!1), [fr, Le] = y(), Cr = ti(), vr = Ke(() => Le(void 0), []), ie = ji({
1483
+ courseId: m,
1484
+ assignmentId: i,
1485
+ assignmentPointsPossible: n,
1486
+ criteria: p.criteria,
1487
+ criteriaRef: f,
1488
+ setRubricFormField: C
1489
+ }), [te, ye] = y(!1), ke = F(null), pe = u && E && !!m, [fe, Te] = y(!1), Pe = F(null);
1490
+ if (r && I)
1491
+ return /* @__PURE__ */ e(nr, {});
1492
+ if (r && L)
1493
+ return Ir({
1494
+ errorImageUrl: ni,
1495
+ errorCategory: d.rubricErrorPageCategory,
1496
+ translations: xe(d)
866
1497
  });
867
- if (r && B && !P)
868
- return Fe({ translations: le(c) });
869
- const Me = () => {
870
- var L;
871
- if (M(!0), !y("title", n.title)) {
872
- (L = G.current) == null || L.focus();
1498
+ if (r && D && !R)
1499
+ return Lr({ translations: xe(d) });
1500
+ const De = () => {
1501
+ var w;
1502
+ if (S(!0), !g("title", p.title)) {
1503
+ (w = z.current) == null || w.focus();
873
1504
  return;
874
1505
  }
875
- if (!(n.criteria.length === 0 || !ee))
876
- switch (x) {
1506
+ if (!(p.criteria.length === 0 || !J))
1507
+ switch (Q) {
877
1508
  case "confirmPointsDifference":
878
- K(!0);
1509
+ re(!0);
879
1510
  break;
880
1511
  case "confirmAssessedEdit":
881
- ie(!0);
1512
+ he(!0);
882
1513
  break;
883
1514
  case "confirmSave":
884
- re(!0);
1515
+ ge(!0);
885
1516
  break;
886
1517
  case "save":
887
1518
  O();
888
1519
  break;
889
1520
  default: {
890
- const He = x;
891
- throw new Error(`Unhandled save action: ${He}`);
1521
+ const Sr = Q;
1522
+ throw new Error(`Unhandled save action: ${Sr}`);
892
1523
  }
893
1524
  }
894
- }, Ae = () => {
895
- const L = br(Ee());
896
- N(L), oe(L.id);
897
- }, Ne = () => {
898
- q ? h(!0) : b();
1525
+ }, Rr = () => {
1526
+ const w = oi(Cr());
1527
+ U(w), Le(w.id);
1528
+ }, Ee = () => {
1529
+ var w;
1530
+ Te(!1), (w = Pe.current) == null || w.focus();
1531
+ }, wr = () => {
1532
+ W ? Ie(!0) : h();
899
1533
  };
900
- return /* @__PURE__ */ m(p, { as: "div", "data-testid": "rubric-builder", children: [
901
- /* @__PURE__ */ m(v, { direction: "column", gap: "medium", padding: "medium 0", children: [
902
- /* @__PURE__ */ e(
903
- qr,
904
- {
905
- isNewRubric: I,
906
- pointsPossible: n.pointsPossible,
907
- hidePoints: n.hidePoints
908
- }
909
- ),
910
- T && /* @__PURE__ */ e(pr, { variant: "error", margin: "0", children: c.rubricFormSaveError }),
911
- /* @__PURE__ */ e(
912
- zr,
913
- {
914
- rubricForm: n,
915
- setRubricFormField: C,
916
- validateTitle: (L) => y("title", L),
917
- titleError: (se = f.title) == null ? void 0 : se.message,
918
- titleInputRef: (L) => {
919
- G.current = L;
920
- },
921
- assignmentSettings: /* @__PURE__ */ e(
922
- Mr,
923
- {
924
- rubricForm: n,
925
- canUseForGrading: d,
926
- setRubricFormField: C
927
- }
928
- )
929
- }
930
- ),
931
- /* @__PURE__ */ e(
932
- Ar,
1534
+ return /* @__PURE__ */ b(P, { as: "div", "data-testid": "rubric-builder", children: [
1535
+ /* @__PURE__ */ b(k, { gap: "medium", wrap: "wrap", alignItems: "start", padding: "medium 0", children: [
1536
+ /* @__PURE__ */ e(k.Item, { shouldGrow: !0, shouldShrink: !0, size: "20rem", children: /* @__PURE__ */ b(k, { direction: "column", gap: "medium", children: [
1537
+ /* @__PURE__ */ e(
1538
+ Ni,
1539
+ {
1540
+ isNewRubric: E,
1541
+ pointsPossible: p.pointsPossible,
1542
+ hidePoints: p.hidePoints
1543
+ }
1544
+ ),
1545
+ _ && /* @__PURE__ */ e(di, { variant: "error", margin: "0", children: d.rubricFormSaveError }),
1546
+ /* @__PURE__ */ e(
1547
+ Fi,
1548
+ {
1549
+ rubricForm: p,
1550
+ setRubricFormField: C,
1551
+ validateTitle: (w) => g("title", w),
1552
+ titleError: (Me = v.title) == null ? void 0 : Me.message,
1553
+ titleInputRef: (w) => {
1554
+ z.current = w;
1555
+ },
1556
+ assignmentSettings: /* @__PURE__ */ e(
1557
+ ki,
1558
+ {
1559
+ rubricForm: p,
1560
+ canUseForGrading: l,
1561
+ setRubricFormField: C
1562
+ }
1563
+ )
1564
+ }
1565
+ ),
1566
+ /* @__PURE__ */ e(
1567
+ Ti,
1568
+ {
1569
+ criteriaCount: p.criteria.length,
1570
+ showMissingCriteriaError: K,
1571
+ actions: /* @__PURE__ */ b(Se, { children: [
1572
+ pe && /* @__PURE__ */ e(
1573
+ H,
1574
+ {
1575
+ color: te ? "ai-primary" : "ai-secondary",
1576
+ renderIcon: te ? /* @__PURE__ */ e(me, {}) : /* @__PURE__ */ e(sr, {}),
1577
+ "aria-expanded": te,
1578
+ "aria-controls": br,
1579
+ onClick: () => ye((w) => !w),
1580
+ elementRef: (w) => {
1581
+ ke.current = w;
1582
+ },
1583
+ "data-testid": "rubric-builder-generator-toggle",
1584
+ children: d.rubricBuilderGeneratorToggle
1585
+ }
1586
+ ),
1587
+ /* @__PURE__ */ e(
1588
+ H,
1589
+ {
1590
+ renderIcon: /* @__PURE__ */ e(lr, {}),
1591
+ onClick: Rr,
1592
+ disabled: ie.isPending,
1593
+ "data-testid": "rubric-builder-add-criterion",
1594
+ children: d.rubricBuilderAddCriterion
1595
+ }
1596
+ )
1597
+ ] }),
1598
+ panel: pe && m && // Hidden rather than unmounted, so a run and its result survive a collapse.
1599
+ /* @__PURE__ */ e("div", { hidden: !te, children: /* @__PURE__ */ e(
1600
+ Vi,
1601
+ {
1602
+ courseId: m,
1603
+ generator: ie,
1604
+ onCancel: () => {
1605
+ var w;
1606
+ ie.resetOptions(), ye(!1), (w = ke.current) == null || w.focus();
1607
+ }
1608
+ }
1609
+ ) }),
1610
+ children: /* @__PURE__ */ e(
1611
+ xi,
1612
+ {
1613
+ criteria: p.criteria,
1614
+ hidePoints: p.hidePoints,
1615
+ freeFormCriterionComments: p.freeFormCriterionComments,
1616
+ ratingOrder: p.ratingOrder,
1617
+ criteriaValidationErrors: Z,
1618
+ showErrors: K,
1619
+ focusNameCriterionId: fr,
1620
+ onFocusedName: vr,
1621
+ onChangeCriterion: U,
1622
+ onDuplicateCriterion: (w) => U(ai(w)),
1623
+ onDeleteCriterion: ee,
1624
+ onReorderCriteria: j
1625
+ }
1626
+ )
1627
+ }
1628
+ ),
1629
+ pe && /* @__PURE__ */ e(qi, { generator: ie })
1630
+ ] }) }),
1631
+ fe && /* @__PURE__ */ e(k.Item, { shouldGrow: !0, shouldShrink: !0, size: "24rem", children: /* @__PURE__ */ e(
1632
+ Gi,
933
1633
  {
934
- criteriaCount: n.criteria.length,
935
- showMissingCriteriaError: H,
936
- actions: /* @__PURE__ */ e(
937
- A,
938
- {
939
- renderIcon: /* @__PURE__ */ e(Le, {}),
940
- onClick: Ae,
941
- "data-testid": "rubric-builder-add-criterion",
942
- children: c.rubricBuilderAddCriterion
943
- }
944
- ),
945
- children: /* @__PURE__ */ e(
946
- Gr,
947
- {
948
- criteria: n.criteria,
949
- hidePoints: n.hidePoints,
950
- freeFormCriterionComments: n.freeFormCriterionComments,
951
- ratingOrder: n.ratingOrder,
952
- criteriaValidationErrors: _,
953
- showErrors: H,
954
- focusNameCriterionId: Pe,
955
- onFocusedName: Oe,
956
- onChangeCriterion: N,
957
- onDuplicateCriterion: (L) => N(mr(L)),
958
- onDeleteCriterion: z,
959
- onReorderCriteria: W
960
- }
961
- )
1634
+ rubric: p,
1635
+ savePending: x,
1636
+ onClose: Ee,
1637
+ onSave: De
962
1638
  }
963
- )
1639
+ ) })
964
1640
  ] }),
965
1641
  /* @__PURE__ */ e(
966
- Fr,
1642
+ _i,
967
1643
  {
968
- savePending: R,
969
- onDiscard: Ne,
970
- onSave: Me
1644
+ savePending: x,
1645
+ isPreviewOpen: fe,
1646
+ previewToggleRef: (w) => {
1647
+ Pe.current = w;
1648
+ },
1649
+ onTogglePreview: () => fe ? Ee() : Te(!0),
1650
+ onDiscard: wr,
1651
+ onSave: De
971
1652
  }
972
1653
  ),
973
1654
  /* @__PURE__ */ e(
974
- Z,
1655
+ se,
975
1656
  {
976
- isOpen: j,
977
- heading: c.rubricBuilderDiscardHeading,
978
- body: c.rubricBuilderDiscardBody,
979
- confirmLabel: c.rubricBuilderDiscard,
980
- cancelLabel: c.rubricBuilderKeepEditing,
981
- onConfirm: b,
982
- onDismiss: () => h(!1),
1657
+ isOpen: mr,
1658
+ heading: d.rubricBuilderDiscardHeading,
1659
+ body: d.rubricBuilderDiscardBody,
1660
+ confirmLabel: d.rubricBuilderDiscard,
1661
+ cancelLabel: d.rubricBuilderKeepEditing,
1662
+ onConfirm: h,
1663
+ onDismiss: () => Ie(!1),
983
1664
  "data-testid": "rubric-builder-discard-modal"
984
1665
  }
985
1666
  ),
986
1667
  /* @__PURE__ */ e(
987
- Z,
1668
+ se,
988
1669
  {
989
- isOpen: ke,
990
- heading: c.confirmToContinueHeader,
991
- body: c.gradingHistoryWarning,
992
- confirmLabel: c.saveConfirmModalSave,
993
- cancelLabel: c.cancel,
1670
+ isOpen: gr,
1671
+ heading: d.confirmToContinueHeader,
1672
+ body: d.gradingHistoryWarning,
1673
+ confirmLabel: d.saveConfirmModalSave,
1674
+ cancelLabel: d.cancel,
994
1675
  onConfirm: () => {
995
- re(!1), O();
1676
+ ge(!1), O();
996
1677
  },
997
- onDismiss: () => re(!1),
1678
+ onDismiss: () => ge(!1),
998
1679
  "data-testid": "rubric-builder-save-confirm-modal"
999
1680
  }
1000
1681
  ),
1001
1682
  /* @__PURE__ */ e(
1002
- Z,
1683
+ se,
1003
1684
  {
1004
- isOpen: Te,
1005
- heading: c.confirmToContinueHeader,
1006
- body: c.gradingHistoryWarning,
1007
- confirmLabel: c.editConfirmModalConfirm,
1008
- cancelLabel: c.cancel,
1685
+ isOpen: hr,
1686
+ heading: d.confirmToContinueHeader,
1687
+ body: d.gradingHistoryWarning,
1688
+ confirmLabel: d.editConfirmModalConfirm,
1689
+ cancelLabel: d.cancel,
1009
1690
  onConfirm: () => {
1010
- ie(!1), O();
1691
+ he(!1), O();
1011
1692
  },
1012
- onDismiss: () => ie(!1),
1693
+ onDismiss: () => he(!1),
1013
1694
  "data-testid": "rubric-builder-assessed-edit-modal"
1014
1695
  }
1015
1696
  ),
1016
1697
  /* @__PURE__ */ e(
1017
- $r,
1698
+ Ai,
1018
1699
  {
1019
- isOpen: xe,
1020
- assignmentPoints: a ?? 0,
1021
- rubricPoints: n.pointsPossible,
1700
+ isOpen: pr,
1701
+ assignmentPoints: n ?? 0,
1702
+ rubricPoints: p.pointsPossible,
1022
1703
  onChange: () => {
1023
- K(!1), O(!1);
1704
+ re(!1), O(!1);
1024
1705
  },
1025
1706
  onLeaveDifferent: () => {
1026
- K(!1), O(!0);
1707
+ re(!1), O(!0);
1027
1708
  },
1028
- onDismiss: () => K(!1)
1709
+ onDismiss: () => re(!1)
1029
1710
  }
1030
1711
  )
1031
1712
  ] });
1713
+ }, Nt = (r) => /* @__PURE__ */ e(we, { translations: r.translations, children: /* @__PURE__ */ e(
1714
+ je,
1715
+ {
1716
+ courseId: r.courseId,
1717
+ featureFlags: r.featureFlags,
1718
+ aiLimits: r.aiLimits,
1719
+ children: /* @__PURE__ */ e(Yi, { ...r })
1720
+ }
1721
+ ) }), Yi = ({
1722
+ courseId: r,
1723
+ assignmentId: a,
1724
+ assignmentPointsPossible: s,
1725
+ canManageRubrics: i,
1726
+ canUseForGrading: n = !0,
1727
+ featureFlags: l,
1728
+ aiLimits: o,
1729
+ onAssignmentPointsPossibleChange: m,
1730
+ onRubricChange: t
1731
+ }) => {
1732
+ const { translations: c } = B(), h = We(), { rubric: d, rubricAssociation: u, isLoading: p, error: f, applySavedRubric: C, reload: g } = li({
1733
+ courseId: r,
1734
+ assignmentId: a,
1735
+ canUseForGrading: n,
1736
+ onAssignmentPointsPossibleChange: m,
1737
+ onRubricChange: t
1738
+ }), [v, E] = y(0), R = F(null), I = () => E((D) => D + 1);
1739
+ N(() => {
1740
+ var D, x;
1741
+ v > 0 && ((x = (D = R.current) == null ? void 0 : D.querySelector('input[data-testid="rubric-builder-name"]')) == null || x.focus());
1742
+ }, [v]);
1743
+ const L = (D, x) => C(D, x, () => {
1744
+ g().finally(I);
1745
+ });
1746
+ return p ? /* @__PURE__ */ e(nr, {}) : f ? /* @__PURE__ */ e(Bi, { variant: "error", children: c.rubricAssignmentContainerLoadError }) : /* @__PURE__ */ e("div", { ref: R, children: /* @__PURE__ */ e(
1747
+ Ki,
1748
+ {
1749
+ translations: h,
1750
+ courseId: r,
1751
+ featureFlags: l,
1752
+ aiLimits: o,
1753
+ assignmentId: a,
1754
+ assignmentPointsPossible: s,
1755
+ rubric: d,
1756
+ rubricAssociation: u,
1757
+ canUseForGrading: n,
1758
+ canManageRubrics: i,
1759
+ onSaveRubric: L,
1760
+ onDiscard: I
1761
+ },
1762
+ v
1763
+ ) });
1032
1764
  };
1033
1765
  export {
1034
- ki as DEFAULT_AI_MAX_CRITERION_COUNT,
1035
- Ti as DEFAULT_AI_MAX_RATING_COUNT,
1036
- yi as HelloWorld,
1037
- Ii as RubricBuilder,
1038
- Di as RubricSelector,
1039
- xi as defaultRubricsTranslations
1766
+ zt as DEFAULT_AI_MAX_CRITERION_COUNT,
1767
+ $t as DEFAULT_AI_MAX_RATING_COUNT,
1768
+ Gt as HelloWorld,
1769
+ Nt as RubricAssignmentBuilder,
1770
+ Ki as RubricBuilder,
1771
+ _t as RubricSelector,
1772
+ Ut as defaultRubricsTranslations
1040
1773
  };