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